Admob显示在标签布局的列表视图中 [英] Admob showing over a listview in tab layout

查看:62
本文介绍了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.

这篇关于Admob显示在标签布局的列表视图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆