zoukankan      html  css  js  c++  java
  • 切换选项卡

    <?xml version="1.0" encoding="utf-8"?>
    <TabHost xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical">
            <TabWidget 
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"/>
            <FrameLayout 
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">
                <!-- 定义第一个标签页 -->
                <LinearLayout 
                    android:id="@+id/tab01"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"></LinearLayout>
                <!-- 定义第二个标签页 -->
                <LinearLayout 
                    android:id="@+id/tab02"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"></LinearLayout>
                <!-- 定义第三个标签页 -->
                <LinearLayout 
                    android:id="@+id/tab03"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:orientation="vertical"></LinearLayout>
            </FrameLayout>
        </LinearLayout>
    </TabHost>
    

    注意:

    TabHost的ID应该为@android:id/tabhos

    TabWidget的ID应该为@android:id/tabs

    FrameLayout的ID应该为@android:id/tabcontent


    Android平台不推荐使用TabActivity。而是推荐使用Fragment

  • 相关阅读:
    HDU 2328 POJ 3450 KMP
    挨踢江湖之十八
    Solr4.2迁移到新项目下异常:java.lang.NoSuchMethodError: org.apache.http.conn.scheme.Scheme.<init>
    滚动条
    《取悦症》听书笔记
    《洞见远胜创意》听书笔记-如何获得洞见
    《乌合之众》听书笔记
    《巨人的工具》听书笔记
    程序员职业生涯规划
    2017第20周摘录
  • 原文地址:https://www.cnblogs.com/unclejelly/p/4082122.html
Copyright © 2011-2022 走看看