Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-使用Admob查看图像的广告_Android_Image_Android Layout_Admob - Fatal编程技术网

Android-使用Admob查看图像的广告

Android-使用Admob查看图像的广告,android,image,android-layout,admob,Android,Image,Android Layout,Admob,在我的andriod应用程序中,我有一个图像视图和后退和下一步按钮,如下所示。它很好用。现在我想在按钮下方或按钮上方但图像下方绘制admob广告。在任何情况下,我不希望图像被广告或按钮裁剪。 以下是包含图像和两个按钮的布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layo

在我的andriod应用程序中,我有一个图像视图和后退和下一步按钮,如下所示。它很好用。现在我想在按钮下方或按钮上方但图像下方绘制admob广告。在任何情况下,我不希望图像被广告或按钮裁剪。 以下是包含图像和两个按钮的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:orientation="vertical" 
    android:id="@+id/Linear1">



    <RelativeLayout android:id="@+id/relativeLayout1"

        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:orientation="vertical">

        <ImageView android:id="@+id/katha_image"
        android:layout_height="wrap_content" android:layout_width="wrap_content"
         android:layout_marginBottom="@dimen/menu_item_size"></ImageView>


        <LinearLayout android:layout_width="fill_parent"
            android:orientation="horizontal" android:layout_height="wrap_content"
            android:layout_alignParentBottom="true" android:layout_gravity="bottom|center">
            <Button android:id="@+id/Button_Back" android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:layout_weight="50"
                android:layout_alignParentBottom="true"

                android:layout_alignParentLeft="true" android:text="@string/back"
                android:textSize="@dimen/button_size" android:minWidth="75px"></Button>
            <Button android:text="@string/next" android:textSize="@dimen/button_size"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:layout_weight="50" android:id="@+id/Button_Next"></Button>



        </LinearLayout>


    </RelativeLayout>



</LinearLayout>

请建议


PC

您需要使用上面的
android:layout\u
或下面的
android:layout\u
将您的元素放在相对位置,这样它们就不会重叠

<com.google.ads.AdView xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
                       android:id="@+id/adView"
                       android:layout_width="fill_parent"
                       android:layout_height="wrap_content"
                       ads:adUnitId="MY_AD_UNIT_ID"
                       ads:adSize="BANNER"
                       ads:loadAdOnCreate="true"
                       android:layout_above="@id/linearLayout1"/>
<!-- Assumes your LinearLayout with buttons have id "linearLayout1" -->


然后在ImageView上添加
android:layout_over=“@id/adView”
,使其位于广告上方。

难以理解。您可以显示所需布局的图像吗?第一次定义id时,您需要使用
@+id/..
而不是
@id/..
。根据需要在布局中修复此问题-它可能与上面的示例略有不同。