我在我的Android游戏中添加了AdMob代码,但广告没有显示 . 检查LogCat并收到广告,查看我的AdMob帐户和游戏变绿,请求是100%填充率好 . 我没有触摸xml,只是onCreate . 请告诉我是否可以用xml或其他任何东西做 . 我把所有权限都放在了清单中 . 请看看并帮助,已经10天遇到麻烦了 . 谢谢

我的代码:

Window window = getWindow();
    RelativeLayout adsLayout = new RelativeLayout(this);
    RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
           RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.MATCH_PARENT);
     // Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
    adsLayout.setGravity(Gravity.TOP);
    AdView adView = new AdView(this, AdSize.BANNER, "myid");  // add your app-id
    adsLayout.addView(adView);
    AdRequest newAdReq = new AdRequest();
    //Remark: uncomment next line for testing your Ads (fake ads)
    newAdReq.setTesting(false);
    adView.loadAd(newAdReq);
    window.addContentView(adsLayout,lp2);

Android清单:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
    <activity android:name=".MYGAMENAME"
              android:label="@string/app_name" 
              android:screenOrientation="landscape" 
              android:configChanges="orientation|screenLayout">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

</application>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

我的Main.xml:

xmlns:android =“http://schemas.android.com/apk/res/android”android:orientation =“vertical”android:layout_width =“fill_parent”android:layout_height =“fill_parent”