0
我试图对齐选项卡布局顶部的广告布局,并没有太大的运气。它似乎卡在底部对齐。我已经配置了标签布局,使标签是在屏幕的底部:对齐顶部的广告布局
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<RelativeLayout
android:id="@+id/adLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp"
>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="0dp"
/>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="23dp"
android:background="@drawable/tab_bg_selector"
android:layout_weight="0"
/>
</LinearLayout>
</TabHost>
更新:
我解决这个问题,我忘了我是设置对齐的代码,如下所示:
final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
一旦我将ALIGN_PARENT_BOTTOM更改为ALIGN_PARENT_TOP,它就起作用了。
大约一半,在的结束LinearLayout有一个'/>',它不应该在那里。此外,我会尝试将TabHost作为一个FrameLayout,因为它就是它的扩展。试着玩弄不同观点的严重性。最后,您可以将TabHost放入ViewGroup中,并将adLayout放置在同一ViewGroup中的上方。 – 2011-12-24 05:15:13
谢谢,我摆脱了额外的右括号 – 2011-12-24 15:20:30