android设置Tabhost中的TabWidget在Framelayout的下方
2014-05-27 19:07
405 查看
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- 此处可以添加其他控件,比如TextView --> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:text="TabWidget" android:textSize="20sp" > </TextView> <TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- 此处设置layout_height="0dp" layout_weight="1" --> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" > <LinearLayout android:id="@+id/tab1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/tab2" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/tab3" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </LinearLayout> <LinearLayout android:id="@+id/tab4" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > </LinearLayout> </FrameLayout> <!-- 将TabWidget从FrameLayout上方移下来,更改layout_height="wrap_content" --> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" > </TabWidget> </LinearLayout> </TabHost> </LinearLayout>
见代码中的注释,可以直接copy代码到环境中看效果。
相关文章推荐
- Android TabHost,TabWidget,FrameLayout 选项卡总结
- android开发之如何使TabHost的TabWidget位于屏幕下方
- Android之玩转选项卡(TabHost、TabWidget、FrameLayout)
- Android练习-----选项卡(TabHost)、(TabWidget)、(FrameLayout)
- Android程序开发之自定义设置TabHost,TabWidget样式
- Android TabWidget/TabHost有两种使用方法
- Android入门第十一篇之TabHost,TabWidget
- Android入门之TabHost与TabWidget实例解析
- 【Android基础篇】TabWidget设置背景和字体
- Android选项卡实现之TabHost/TabSpec/TabWidget
- Android入门第十一篇之TabHost,TabWidget
- Android:实现TabWidget选项卡按钮在屏幕下方
- [BUG]Your TabHost must have a TabWidget whose id attribute is ‘android.R.id.tabcontent’
- TabHost requires a TabWidget with id "android:id/tabs" 报错解决办法
- Android TabWidget/TabHost的使用
- Android TabHost设置不加载第一个tab
- android应用开发揭秘之examples_04_29(TabWidget及FrameLayout)
- 设置TabHost中TabWidget的字体及图片样式
- Android TabHost,TabWidget选项卡总结
- android 标签页的实现 TabHost TabWidget TabActivity