我正在尝试将广告永久显示在布局的底部。我正在使用 tabhost,当我将广告放置在 freamelayout 上方时,它会在顶部显示广告。我想把这个广告放在底部。这是我的布局文件的代码。
<?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"
android:background="@drawable/background_splash"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<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="match_parent"
/>
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="480dp"
android:layout_height="100dp"
ads:adUnitId="XXXXXXXXX"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR, XXXXXXXX"
ads:loadAdOnCreate="true"/>
</LinearLayout>
</TabHost>
当我将 adview 放置在框架布局之前时,它会向我显示广告,但我想在 tabhost 的底部显示广告。
谢谢, 安缦
最佳答案
问题在于 FrameLayout 的高度设置为 match_parent。
您需要做的是将FrameLayout的layout_height设置为0dip,然后将layout_weight指定为1。这将指示它填充空间。
关于java - 无法将广告放置在线性布局的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15175078/