• 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后面。
  • 相关阅读:
    css3转换
    JavaScript函数
    JavaScript数组
    JavaScript流程控制
    JavaScript数据类型、运算
    css3响应布局
    css3渐变、背景、过渡、分页
    css3初识
    CSS3选择器
    H5拖拽、绘画、web存储
  • 原文地址:https://www.cnblogs.com/xiaoran1129/p/2794612.html
Copyright © 2020-2023  润新知