android - Admob背景总是黑色

标签 android colors background admob

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

请帮帮我。谢谢。

主要 Activity

@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>

Android list

<?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 控制面板中应用的配置仅适用于基于文本的广告。

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

关于android - Admob背景总是黑色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20827686/

相关文章:

iphone - 如何使带有按钮的 UITableViewCell 背景透明

html - 奇怪的 CSS 问题 - 背景属性在没有图像高度的情况下不起作用

android - 如何在任何 Android 手机中查找和收集给定联系人中的所有可用信息?

javascript - React native 网络连接在 Android 中有效,但在 IOS 中无效

objective-c - UINavigationController 以编程方式全局更改导航栏色调颜色

c++ - 如何从 qplaintextedit 获取文本颜色?

android - Google Play 中的下载次数

Android:想要为整个应用程序而不是运行时设置自定义字体

具有替代颜色和焦点颜色的Android ListView

image - Windows Phone 8 - 在后台生成锁屏图像