【发布时间】:2017-05-23 05:08:01
【问题描述】:
在 Google 商店中使用我的应用程序 2 周后,我意识到横幅并未在真实设备中显示。当我用 Android Studio 虚拟设备测试它时,它很好。
这是我的 MainActivity 中与横幅相关的代码:
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder().build();
mAdView.loadAd(request);
和布局:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/gray_background">
<com.flaviofaria.kenburnsview.KenBurnsView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:layout_marginTop="?attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="misc.songbox.Search"
android:orientation="vertical">
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/bannerAd">
</com.google.android.gms.ads.AdView>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:dividerHeight="0dp"
/>
</LinearLayout>
</RelativeLayout>
【问题讨论】:
-
AdView应该在最上层 -
你是什么意思?