Android Admob背景始终为黑色

Android Admob背景始终为黑色,android,colors,background,admob,Android,Colors,Background,Admob,在Admob网站上,我创建了一个蓝色背景的广告,但在我的ap背景中是黑色的。 我尝试在代码中手动添加颜色,但广告背景始终为黑色 请帮帮我。多谢各位 主要活动 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toPhone = R.drawable

在Admob网站上,我创建了一个蓝色背景的广告,但在我的ap背景中是黑色的。 我尝试在代码中手动添加颜色,但广告背景始终为黑色

请帮帮我。多谢各位

主要活动

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    toPhone = R.drawable.wall1;
    AdView adview = (AdView)findViewById(R.id.ad);
    AdMobAdapterExtras extras = new AdMobAdapterExtras()
    .addExtra("color_bg", "6D0504")
    .addExtra("color_bg_top", "6D0504")
    .addExtra("color_border", "6D0504")
    .addExtra("color_link", "000080")
    .addExtra("color_text", "808080")
    .addExtra("color_url", "008000");

    AdRequest adreq = new AdRequest();
    adreq.setNetworkExtras(extras);
    adview.setBackgroundColor(Color.parseColor("#128cff"));
    adview.loadAd(adreq);
主布局

<com.google.ads.AdView
android:id="@+id/ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-xxxxxxxxxxxxxxx"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"  
android:background="#128cff"
ads:background="#6D0504"
android:gravity="center" >
</com.google.ads.AdView>

安卓清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.technozed.ios7stylehdwallpapers"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.SET_WALLPAPER"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
     >
     <activity android:name="com.google.ads.AdActivity" 
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
    <activity
        android:screenOrientation="portrait"
        android:name="app.technozed.ios7stylehdwallpapers.MainActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

您在Admob仪表板中应用的配置仅适用于基于文本的广告


基于图像的广告将有自己的背景,您无法更改。

在admob dashboard中检查您的广告设置。你需要启用“在客户端代码中设置使用颜色”。@Tarun这是我在AdMob中设置的,在我的应用程序中,图像横幅和文本横幅的黑色背景相同。我在admob选项中更改了颜色。