这个是主类
再看看主布局文件:
- <?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: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="wrap_content"
- android:layout_weight="1">
- </FrameLayout>
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="fill_parent"
- android:layout_alignParentBottom="true"
- android:layout_height="wrap_content"/>
- </LinearLayout>
- </TabHost>
这样,基本上一个可用的tabhost就可以了。
附件是代码
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2012年资料/6月/18日/Android中实现底部Tabhost【附源码】/
