に画面上に表示されていませんxml、すべて正常に動作しますが、広告はランドスケープモードや大画面では良好に表示されません。だから私はadSizeを "SMART_BANNER"に変更しようとしていますが、何らかの理由でバナーが横長モードでのみ表示されていて、肖像画に白い広告が表示されています。私はここで何が欠けていますか?ここでAndroid-スマートバナー広告は、私は私のアプリに広告を使用している、と私はここのチュートリアルに従っているポートレートモード
コードです:
activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:padding="0dp"
tools:context="com.example.shaytsabar.footballtables
.activities.MainActivity"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="81dp"
android:layout_marginLeft="0dp">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar_con"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:elevation="0dp"
android:minHeight="?attr/actionBarSize"
android:padding="0dp"
android:paddingBottom="0dp"
android:paddingEnd="0dp"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingStart="0dp"
android:paddingTop="0dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
ads:adSize="SMART_BANNER"
ads:adUnitId="@string/ad_id"
ads:layout_constraintBottom_toBottomOf="parent"
ads:layout_constraintLeft_toLeftOf="parent"
ads:layout_constraintRight_toRightOf="parent">
</com.google.android.gms.ads.AdView>
<FrameLayout
android:id="@+id/fragment_con"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:elevation="0dp"
android:padding="0dp"
app:layout_constraintBottom_toTopOf="@+id/adView"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/toolbar_con"
app:layout_constraintVertical_bias="0.0">
</FrameLayout>
</android.support.constraint.ConstraintLayout>
MainActivity.java:
public class MainActivity extends AppCompatActivity{
InterstitialAd mInterstitialAd;
AdView mAdView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MobileAds.initialize(this, APPCODE);
ShowLittleAd();
mAdView.setAdListener(new AdListener() {
@Override
public void onAdFailedToLoad(int i) {
super.onAdFailedToLoad(i);
ShowLittleAd();
}
});
}
public void ShowLittleAd(){
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new
AdRequest.Builder().addTestDevice("//MY DEVICE").
addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
mAdView.loadAd(adRequest);
}
}
ここにログを投稿してください..LogcatはAdmobによって投げられた例外を記録しているに違いありません...レイアウトと高さ –
ShowLittleAd()をtryとcatchで囲みようとしましたが、logCatにエラー – Shayts
がありませんでした。「広告」をフィルタリングしようとしました。あなたはどんな痕跡を見ますか? –