zoukankan      html  css  js  c++  java
  • TabHost和TabWidget写出微信下面选项卡的界面


    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后面。
  • 相关阅读:
    linux内核(四)内存管理单元MMU
    open函数详解
    linux内核(三)文件系统
    C++中数字与字符串之间的转换 scanf string总结(复习必读)
    hello程序的运行过程-从计算机系统角度
    剑指offer第12题打印从1到n位数以及大整数加法乘法
    2017-10-11第二次万革始面经
    为什么需要半关闭
    Ubuntu指令
    143. Reorder List
  • 原文地址:https://www.cnblogs.com/xiaoran1129/p/2794612.html
Copyright © 2011-2022 走看看