Android 之Tab
引用
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
相关推荐
huha 2020-10-16
xfcyhades 2020-11-20
sgafdsg 2020-11-04
Michael 2020-11-03
fengyeezju 2020-10-14
ziyexiaoxiao 2020-10-14
业余架构师 2020-10-09
OuNuo0 2020-09-29
moses 2020-09-22
Angelia 2020-09-11
qinxu 2020-09-10
刘炳昭 2020-09-10
Nostalgiachild 2020-09-07
Nostalgiachild 2020-08-17
leavesC 2020-08-14
一青年 2020-08-13
AndroidAiStudy 2020-08-07
ydc0 2020-07-30
绿豆饼 2020-07-28