Android的广告版式问题

普里亚

我正在尝试在我的一个Android应用程序中添加AdMob标语。我已经尝试了很多方法,但是无法显示在布局的底部。我已经附上了我的活动中的代码。请检查,并让我知道它有什么问题。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/main_layout_background_color"
    android:orientation="vertical">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/colorPrimary"
        android:elevation="6dp"
        android:minHeight="?attr/actionBarSize">

    </android.support.v7.widget.Toolbar>


    <GridView
        android:id="@+id/lv_Levels"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:background="@android:color/transparent"
        android:horizontalSpacing="20dp"
        android:numColumns="3"
        android:stretchMode="columnWidth"
        android:verticalSpacing="20dp">

    </GridView>

    <LinearLayout
        android:id="@+id/ad"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/main_layout_background_color"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:gravity="center"
        android:orientation="horizontal">
        <com.google.android.gms.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|center"
            ads:adSize="BANNER"
            ads:adUnitId="@string/banner_ad_unit_id">
        </com.google.android.gms.ads.AdView>

    </LinearLayout>

</LinearLayout>

我无法保持低谷。它不显示在屏幕上,因此不显示。

在此处输入图片说明

谢谢

尼勒什·辛格(Nilesh Singh)

这将解决问题:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/RelativeLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/main_layout_background_color">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?attr/colorPrimary"
            android:elevation="6dp"
            android:minHeight="?attr/actionBarSize">

        </android.support.v7.widget.Toolbar>


        <GridView
            android:id="@+id/lv_Levels"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@android:color/transparent"
            android:horizontalSpacing="20dp"
            android:layout_below:"@+id/toolbar"
            android:layout_above:"@+id/ad"
            android:numColumns="3"
            android:stretchMode="columnWidth"
            android:verticalSpacing="20dp">

        </GridView>

        <LinearLayout
            android:id="@+id/ad"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/main_layout_background_color"
            android:layout_alignParentBottom="true"
            android:gravity="center"
            android:orientation="horizontal">

            <com.google.android.gms.ads.AdView
                android:id="@+id/adView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom|center"
                ads:adSize="BANNER"
                ads:adUnitId="@string/banner_ad_unit_id">
            </com.google.android.gms.ads.AdView>

        </LinearLayout>

    </RelativeLayout>

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Xamarin Android-添加admob广告问题

来自分类Dev

Android版式上下

来自分类Dev

Android版式优先?

来自分类Dev

Android版式TextView

来自分类Dev

日历控制的Android版式

来自分类Dev

自动版式:问题>更新框架

来自分类Dev

iOS中的自动版式问题

来自分类Dev

为什么自动版式在此版式上存在问题

来自分类Dev

Android studio问题:找不到广告:AdQuality:未指定

来自分类Dev

Android版式无法正常工作

来自分类Dev

iAd横幅广告问题

来自分类Dev

cron的pam /广告问题

来自分类Dev

Android版式:运行第二个版式传递

来自分类Dev

Xcode 8-自动版式问题

来自分类Dev

Android版式-何时使用app:vs android :?

来自分类Dev

Android View填充版式的中心区域

来自分类Dev

在Android版式中扭曲了ProgressBar微调器

来自分类Dev

Android版式:父宽度的一半

来自分类Dev

Android版式对齐方式在Landscape中混乱了

来自分类Dev

Android:无法在版式中填充EditText

来自分类Dev

无法使用Android版式充气机?

来自分类Dev

Google Play广告SDK问题

来自分类Dev

点击广告以解决游戏问题

来自分类Dev

我关于在 android 应用程序中添加谷歌广告的问题

来自分类Dev

使用Android广告ID?

来自分类Dev

Android上的iBeacon广告

来自分类Dev

Android 横幅广告布局

来自分类Dev

Ble Android 广告:AddServiceData

来自分类Dev

DFP广告管理系统问题:无广告展示