Admob显示在标签布局的列表视图中

问题描述:

我有一个TabLayout,其中有一个ListView显示为意图.我想在此布局中放置一个admob横幅,但是它将遍历ListActivity和我之前定义的列表的最后一项.我该如何工作?

i have a TabLayout that has a ListView to show as intent. I would like to put an admob banner in this layout, but it goes over the ListActivity, over the last item of the list i defined before. How can i get this working?

现在发布main.xml:

Posting now the main.xml:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="top"
    android:orientation="vertical"
    android:padding="5dp" >

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" >

    </FrameLayout>

</LinearLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:gravity="bottom" >

<com.google.ads.AdView
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"

            ads:adSize="BANNER"
            ads:adUnitId="a14f67193b8a3e1"
            ads:loadAdOnCreate="true"
            ads:testDevices="TEST_EMULATOR, 3433B134225900EC" >

        </com.google.ads.AdView>
 </LinearLayout>

要使AdView占据其自己的空间而不位于其他内容之上,我通常使用RelativeLayout并将android:layout_alignParentBottom="true"粘贴到我的将AdView和android:layout_above="@+id/adView"放到我的*内容视图中.

To get the AdView to take up it's own space and not sit on top of other content, I usually use a RelativeLayout and tack android:layout_alignParentBottom="true" onto my AdView and android:layout_above="@+id/adView" onto my top level content view.