theseは、おそらく私のアンドロイドプロジェクトに広告を挿入(テスト)するための古い手順に従っています。仮想Nexus 5端末でプロジェクトを再コンパイルした後、アプリは動作しますが、追加バナーは表示されません。アンドロイドプロジェクトの広告は表示されません
レイアウトファイルがサンプルレイアウトファイルのように見えないため、レイアウトファイルに問題がある可能性があります。ここでは広告バナーが含まれるように、私のレイアウトファイルの関連する部分です:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity" >
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"/>
</android.support.design.widget.AppBarLayout>
<LinearLayout
...
...
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
は、レイアウトに関連する問題ですか?広告バナーが表示されない理由を理解するにはどうすればよいですか?
LinearLayout内でAdViewのRelativeLayout属性を使用しています。これは問題ではありませんが、AdViewを通常のViewレイアウトに置き換えて、適切に表示されているかどうかを確認する必要があります。 – adelphus