私のアンドロイドミュージックプレーヤーのポップアッププレイヤーにバナーを追加します。 Androidのスタジオプレビューモードでは、エラーはなく、正常に動作しますが、バナーが表示されません。ポップアップにadmobのバナーが表示されない
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="320dp"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/primary"
android:paddingBottom="5dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="20dp">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:maxLines="5"
android:textColor="@color/white"
android:textSize="@dimen/text_medium"
tools:text="Mr.Afghani" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:gravity="center_vertical">
<ImageView
android:id="@+id/play"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="6"
android:src="@mipmap/play" />
<ImageView
android:id="@+id/pause"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="6"
android:src="@mipmap/pause"
android:visibility="gone" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<SeekBar
android:id="@+id/media_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/playback_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|top"
android:ellipsize="end"
android:textColor="@color/white"
android:textSize="11sp"
tools:text="00:00" />
</FrameLayout>
</LinearLayout>
</RelativeLayout>
<com.google.android.gms.ads.AdView
android:id="@id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/bannerAd1" />
</LinearLayout>
mainActivityで私のコードは正しいと思います。私は他の画面にバナーを入れてみましたが、うまくいきました。ポップアップ画面にバナーを入れる方法はありますか?
MainActivityでの私のコードは次のとおりです。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
init();
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest request = new AdRequest.Builder().build();
mAdView.loadAd(request);
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("ca-app-pub-1234");
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest);
mInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
AdRequest adRequest1 = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest1);
}
});
ありがとうナナ、でも同じ問題です。あなたが言ったように投稿された質問を編集しました。どうぞご覧ください。 –
https://ibb.co/dMoraQ ...ここにスクリーンショットがあります。 –
@myads mailあなたがしたことは、ダイアログ自体に影響を与えないレイアウトの幅に設定されています。幅にmatch_parentを使用し、横向きモードでテストして動作するか確認してください。 –