TabHost和TabWidget写出微信下面选项卡的界面


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后面。

更多相关文章

  1. 让应用程序不被任务管理器杀死...(获取系统权限)
  2. Android系统升级的完整过程
  3. Android软键盘-弹起时布局向上拉-登录界面
  4. Android系统构架分析和应用程序目录结构分析
  5. Android系统介绍及平台特性
  6. 图解Android - Android GUI 系统 (5) - Android的Event Input Sy

随机推荐

  1. Android Wifi框架流程分析
  2. Android——分别获取导航栏、状态栏高度
  3. android 判断网络是否可用,并调用系统设置
  4. Android中的bitmap,drawable,canvas以及pai
  5. Lottie开源库实现Android动画效果
  6. Android再按一次退出
  7. Android默认USB为host模式
  8. android 开发使用 kotlin 进行点击事件监
  9. mtk android tp 调试
  10. Android AsyncTask异步实现大文件下载