I’m testing an Adview on my layout. If I place the Adview before the ListView everything is fine but if I place it after the ListView it just doesn’t show up.
What’s wrong?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:background="@android:color/white" />
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="xxxx"
ads:testDevices="xxxx" />
</LinearLayout>
You set the
ListView‘slayout_heighttofill_parent, so it will take all the remaining vertical space in the layout. YourAdViewis there, it was just displaced out of the screen by theListView.If you want to place the
AdViewat the bottom, and have theListViewtake all the remaining vertical space, you can do it with weights: