Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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_Css_Admob_Android Linearlayout - Fatal编程技术网

Android 设置页面AdMob横幅的底部

Android 设置页面AdMob横幅的底部,android,css,admob,android-linearlayout,Android,Css,Admob,Android Linearlayout,我正试图在页面底部设置AdMob横幅,但广告没有显示。 空格显示在页面底部,但AdMob不显示在那里 添加并引用Google Play服务库。-对 在AndroidManifest.xml中添加元数据标记。-对 在清单中声明com.google.android.gms.ads.AdActivity。-对 在清单中设置网络权限。-对 有人告诉我为什么。 多谢各位 我的XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayou

我正试图在页面底部设置AdMob横幅,但广告没有显示。 空格显示在页面底部,但AdMob不显示在那里

  • 添加并引用Google Play服务库。-对
  • 在AndroidManifest.xml中添加元数据标记。-对
  • 在清单中声明com.google.android.gms.ads.AdActivity。-对
  • 在清单中设置网络权限。-对
  • 有人告诉我为什么。 多谢各位

    我的XML

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <LinearLayout
            android:id="@+id/flContainer"                <!-- DATA Layout -->
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/ad_layout"
            android:orientation="vertical" />
    
        <LinearLayout
            android:id="@+id/ad_layout"                  <!-- AdMob Layout -->
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            android:orientation="vertical" />
    
    </RelativeLayout>
    

    你让fldContainer和你的父母配对。这意味着它将消耗家长的所有空间,而不会为您的广告留下任何空间

    相反,请尝试:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <LinearLayout
            android:id="@+id/flContainer"                <!-- DATA Layout -->
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical" />
    
        <LinearLayout
            android:id="@+id/ad_layout"                  <!-- AdMob Layout -->
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:orientation="vertical" />
    
    </LinearLayout>
    
    
    android:layout\u width=“匹配父项”
    android:layout_height=“50dp”
    android:orientation=“垂直”/>
    
    如果您对“flContainer”使用布局重量,我建议该组件的高度为“0dp”。
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <LinearLayout
            android:id="@+id/flContainer"                <!-- DATA Layout -->
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical" />
    
        <LinearLayout
            android:id="@+id/ad_layout"                  <!-- AdMob Layout -->
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:orientation="vertical" />
    
    </LinearLayout>