好吧AdMob真的很奇怪。我想將廣告放在底部我有一個LinearLayout。當我這樣做時,它永遠不會出現。當我把它放在上面時,它顯示完美。不知道這裏的交易是我的代碼。我得到的logcat的一個警告,說: 「沒有足夠的空間來展示廣告想< 480,75>的:< 480,0>」Android AdMob底部不顯示LinearLayout
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/mypackage"
android:id="@+id/mainmenulayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/headerpic"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/header"/>
<ListView android:id="@android:id/list"
android:divider="#00000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:background="@android:color/transparent"
android:cacheColorHint="#00000000"
android:layout_alignParentTop="true">
</ListView>
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="myadunit"
ads:adSize="BANNER"
/>
</LinearLayout>
和我的onCreate():
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.appmenu);
// Look up the AdView as a resource and load a request.
AdView adView = (AdView)this.findViewById(R.id.adView);
adView.loadAd(new AdRequest());
String[] mainMenuList = getResources().getStringArray(R.array.mainMenuList);
TypedArray[] picFiles = getResources().obtainTypedArray(R.array.arrayIcon);
setListAdapter(new MyIconAdapter(mainMenuList, picFiles));
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} //close onCreate
是的,這是否表示感謝,我仍然需要了解重量如何工作。似乎有點向後讓高度0,但看看重量來填補休息。真的變得惱火與android佈局...再次感謝 – JPM 2011-05-04 07:51:14