0
我必須對應於ListActivity下面的XML文件:的ListView阻止AdMob廣告
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/classview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="xxxx" >
</com.google.ads.AdView>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
而且我把這種Java代碼從ListActivity中:
public void setupAd(){
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice("xxxx");
AdView adView = (AdView) findViewById(R.id.adView);
adView.loadAd(adRequest);
}
當我看圖形我的XML文件的佈局,似乎整齊地在ListView頂部有廣告橫幅。但是,當我運行我的實際應用程序時,ListView似乎佔據了整個屏幕,可能會阻止廣告。任何人都知道什麼是錯的?
你有沒有嘗試加載一個真正的添加與真正的ID? –
你的'xml'是正確的,這可能是由於廣告沒有加載!你的**清單中有'internet' *權限*嗎? –
確定它不只是被加載。第一次在第一個廣告出現之前可能需要幾分鐘時間,直到它沒有佔用任何空間。 – Magakahn