Search code examples
javaandroidandroid-studiokotlinadmob

How to change app open ad background admob


I place the banner ad on the top of the main activity, but when the app switch app open ad shows and violate the AdMob (policy )

Is that possible to change the background of the app open ad, as you know that by default app open app ad's background is transparent, As a result, when the app open ad shows, the banner ad is also showing in the background.


Solution

  • Finally, After a lot of research, I found the answer,

    First, create a theme in style.xml or theme.xml file( make app open ad background black)

     <style name="Theme.AppThemeNoActionBar.AdTheme" >
        <item name="android:background">@color/black</item>
        <item name="android:windowBackground">@color/black</item>
        <item name="android:windowExitAnimation">@null</item>
        <item name="android:windowEnterAnimation">@null</item>
    </style>
    

    and declare the activity on the manifest.xml file, and apply the theme

     <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:theme="@style/Theme.AppThemeNoActionBar.AdTheme"
            tools:replace="android:theme"/>