对于Android自带的tabhost组件,是位于页面顶端的,若想让其位于页面底端,在这里提供两种方法。方法一1、tabcontent和tabs交换位置2、设置tabcontent的属性:android:layout_weight="1"<?xmlversion="1.0"encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><TabHostandroid:id="@android:id/tabhost"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_alignParentLeft="true"android:layout_alignParentBottom="true"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><FrameLayoutandroid:id="@android:id/tabcontent"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_weight="1">中间部分省略</FrameLayout><TabWidgetandroid:id="@android:id/tabs"android:layout_width="match_parent"android:layout_height="wrap_content"></TabWidget></LinearLayout></TabHost></RelativeLayout>方法二1、tabcontent和tabs交换位置2、将tabs放到一个relativeLayout中,然后加上如下属性:android:layout_alignParentBottom="true"<?xmlversion="1.0"encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><TabHostandroid:id="@android:id/tabhost"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_alignParentLeft="true"android:layout_alignParentBottom="true"><FrameLayoutandroid:id="@android:id/tabcontent"android:layout_width="match_parent"android:layout_height="match_parent">中间部分省略</FrameLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><TabWidgetandroid:id="@android:id/tabs"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentBottom="true"></TabWidget></RelativeLayout></TabHost></RelativeLayout>方法三1、将tabcontent和tabs交换位置(tabs移动到LinearLayout标签以下)2、在tabcontent中加入属性:android:layout_gravity="top"3、在tabs中加入属性:android:layout_gravity="bottom"<?xmlversion="1.0"encoding="UTF-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent"><TabHostandroid:id="@android:id/tabhost"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_alignParentBottom="true"android:layout_alignParentLeft="true"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><FrameLayoutandroid:id="@android:id/tabcontent"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_gravity="top">中间部分省略</FrameLayout></LinearLayout><TabWidgetandroid:id="@android:id/tabs"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_gravity="bottom"></TabWidget></TabHost></RelativeLayout>

Android 实战教程类FaceBook,欢迎学习交流!!!!

http://edu.51cto.com/course/course_id-3153.html

更多相关文章

  1. EditText的属性!
  2. Android启动模拟器出现:Failed to allocate memory: 8的解决方法
  3. eclipse添加android插件错误处理方法
  4. ReactNative 在用react-navigation组件时,没有 navigator.getCurr
  5. Android Canvas drawArc方法介绍
  6. android 图片的缩放,bitmap的用法 scaletype属性
  7. Android软键盘弹出时把布局顶上去,控件乱套解决方法

随机推荐

  1. jsp登录页面的简单实例 雏形
  2. 光影如何绘画?漫画人物脸部光影画法
  3. 模态框的实例演示
  4. jsp中自定义Taglib详解
  5. 模态框学习与实践
  6. php没有文件被上传的实例分析及解决办法
  7. jsp中自定义Taglib详解
  8. ASP动态include文件
  9. HTML 模态框学习
  10. React入门