TabHost和TabWidget写出微信下面选项卡的界面
2012-11-29 14:38
344 查看
xml界面代码:
<?xml version="1.0" encoding="UTF-8"?> <TabHost android:id="@android:id/tabhost" android:background="@android:color/black" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_weight="1.0" /> <TabWidget android:id="@android:id/tabs" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0.0" /> <RadioGroup android:gravity="center_vertical" android:layout_gravity="bottom" android:orientation="horizontal" android:id="@+id/main_tab" android:background="@drawable/maintab_toolbar_bg" android:layout_width="fill_parent" android:layout_height="wrap_content"> <RadioButton android:id="@+id/resourse" android:layout_marginTop="2.0dip" android:text="常用资源" android:drawableTop="@drawable/icon_res" style="/@style/main_tab_bottom" /> <RadioButton android:id="@+id/search" android:layout_marginTop="2.0dip" android:text="图书搜索" android:drawableTop="@drawable/icon_search" style="/@style/main_tab_bottom" /> <RadioButton android:id="@+id/login" android:layout_marginTop="2.0dip" android:text="用户登录" android:drawableTop="@drawable/icon_login" style="/@style/main_tab_bottom" /> </RadioGroup> </LinearLayout> </TabHost>
需要注意的是<TabWidget> <TabHost> 和<FrameLayout>的Id 必须使用系统id,分别为android:id/tabs android:id/tabhost和 android:id/tabcontent 。因为系统会使用这两个id来初始化TabHost的两个实例变量(mTabWidget 和 mTabContent)。
如果想让选项卡在上面,可以把FrameLayout放在TabWidget后面。
相关文章推荐
- 简单的方法实现仿微信底部的Tab选项卡界面
- Android TabHost,TabWidget选项卡总结
- 使用选项卡TabWidget与TabHost实现底部或者顶部四个分类按钮 点击切换对应的fragment
- 修炼-------------Android TabHost,TabWidget选项卡总结
- Android选项卡实现之TabHost/TabSpec/TabWidget
- 选项卡TabHost、TabWidget和FrameLayout
- Android之玩转选项卡(TabHost、TabWidget、FrameLayout)
- Android TabHost,TabWidget,FrameLayout 选项卡总结
- Android TabHost,TabWidget选项卡总结
- Android练习-----选项卡(TabHost)、(TabWidget)、(FrameLayout)
- TabHost+ViewPager实现 点击选项卡和滑动界面都可以切换页面
- TabWidget/TabHost的两种使用方法
- Android开发中用tabhost实现tab选项卡的切换
- 微信小程序滚动Tab选项卡:左右可滑动切换
- TabActivity,LocalActivityManager,TabHost,TabWidget深度分析(一)
- Android选项卡(TabWidget)例子
- 对TabHost、TabWidget的理解分析
- TabWidget/TabHost的两种使用方法
- TabActivity,LocalActivityManager,TabHost,TabWidget深度分析
- 【Android 界面效果22】Android的Tab与TabHost