添加AD浏览报低于TabHost的XM​​L [英] Adding AdView below TabHost in XML

查看:124
本文介绍了添加AD浏览报低于TabHost的XM​​L的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得的正下方TabHost的AD浏览报。 RelativeLayout的确实允许这种情况发生与安卓layout_alignParentBottom =真正的但是这个重叠TabHost内容,这样做的滚动型的我添加的每个选项卡内(这很可能发生其高度足够大)的任何意见

I am trying to get an AdView directly below a TabHost. RelativeLayout does allow this to happen with android:layout_alignParentBottom="true" however this overlaps TabHost contents, and does so for the ScrollView's I add inside each Tab (this would probably occur for any views whose height was large enough)

目前最接近我能得到具有TabHost和AD浏览报在自己的屏幕上单独的空间使用这个code(下图),可以让我有一个广告直接上面在TabHost ......如此接近,任何想法?

Right now the closest I can get to having a TabHost and AdView in their own seperate space on the screen is using this code (below), that allows me to have a Ad directly above the TabHost...so close, any ideas?

<?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:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.google.ads.AdView
        android:id="@+id/ad"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="####"
        ads:loadAdOnCreate="true"
        ads:testDevices="####" />

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <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" />
        </LinearLayout>
    </TabHost>

</LinearLayout>

推荐答案

您应该让标签主机像

<TabHost
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="0dip" 
    android:layout_weight="1.0">

现在的标签主机将采取AD浏览后的剩余空间。

Now the tab host will take the remaining space after the adview.

这篇关于添加AD浏览报低于TabHost的XM​​L的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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