引用
http://fatkun.com/2010/06/android-tabwidget.html


注意:TabHost ,TabWidget ,FrameLayout的ID必须分别为@android:id/tabhost,@android:id/tabs,@android:id/tabcontent
另外还要注意一下android:layout_width宽度和android:layout_height高度的取值,还要LinearLayout的android:orientation=”vertical”(LinearLayout默认是横向的)当你看到布局和我不一样时你就要考虑一下这里是不是错了。(= =!因为我错过)

<?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="fill_parent"    android:layout_height="fill_parent"     >   <LinearLayout        android:layout_width="fill_parent"        android:layout_height="fill_parent"        android:orientation="vertical" >        <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:layout_width="fill_parent"            android:layout_height="wrap_content"            android:layout_weight="0.0"            android:visibility="gone" />                <RadioGroup            android:id="@id/main_radio"            android:layout_width="fill_parent"            android:layout_height="wrap_content"            android:layout_gravity="bottom"            android:background="@drawable/maintab_toolbar_bg"            android:gravity="center_vertical"            android:orientation="horizontal" >            <RadioButton                android:id="@id/radio_button0"                style="@style/main_tab_bottom"                android:layout_marginTop="2.0dip"                android:drawableTop="@drawable/icon_1_n"                android:text="@string/main_news" />            <RadioButton                android:id="@id/radio_button1"                style="@style/main_tab_bottom"                android:layout_marginTop="2.0dip"                android:drawableTop="@drawable/icon_2_n"                android:text="@string/main_down" />            <RadioButton                android:id="@id/radio_button2"                style="@style/main_tab_bottom"                android:layout_marginTop="2.0dip"                android:drawableTop="@drawable/icon_3_n"                android:text="@string/main_message" />            <RadioButton                android:id="@id/radio_button3"                style="@style/main_tab_bottom"                android:layout_marginTop="2.0dip"                android:drawableTop="@drawable/icon_5_n"                android:text="@string/more" />        </RadioGroup>    </LinearLayout>   </TabHost>


http://aina-hk55hk.iteye.com/blog/686249

更多相关文章

  1. Android学习笔记001_布局01
  2. android - seekbar 宽度全屏的坑
  3. TextView跑马灯效果
  4. Gridview的stretchMode详解附自动宽度
  5. Gridview的stretchMode详解附自动宽度
  6. Android(安卓)使用 TableLayout 布局拉伸宽度
  7. Android(安卓)GridView属性
  8. android:layout_weight详解 (总结版)
  9. Android中的android:layout_width和android:width

随机推荐

  1. android配置gradle国内镜像
  2. 【Android】在android studio中使用asser
  3. Android Installation failed with messa
  4. android 所有的传感器
  5. Android --- Input System
  6. Android7.0 MTK 需求文档(二)
  7. gdb调试 android webkit
  8. log4cpp Android(安卓)JNI开发移植
  9. Android 主题和样式
  10. android模拟器在ubuntu8.10下的安装