首页 > 解决方案 > AdMob Adaptive/Smart Banner Background Color Android

问题描述

There is a good Google AdMob Adaptive Banner with Android Studio integration instruction: https://codelabs.developers.google.com/codelabs/adaptive-banner-android-studio

I follow it exactly as described in the example step by step. Step 6 says I can set the background in my layout xml file:

<FrameLayout
 android:id="@+id/adView_container"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 app:layout_constraintBottom_toBottomOf="parent"
 app:layout_constraintLeft_toLeftOf="parent"
 app:layout_constraintRight_toRightOf="parent"
 android:background="#666666">

Then there should be gray banner background as they picked it for the example. However all my emulators and physical devices show no background color at all...

When reply from AdMob not received yet background appears for a fraction of a second. But then after receiving the banner from AdMob background becomes black.

I think no need for code snippets as it is exactly the same as in the example step by step. See link above. My Android Studio version 4.0, Android Gradle Plugin 4.0.1, Gradle 6.1.1, gms play services ads 19.3.0.

Has anyone had a similar problem? What could be causing this problem? Any ideas?

标签: androidbanner

解决方案


推荐阅读