设置tabhost位于底部的三种方法
来源:互联网 发布:产品数据分析指标 编辑:程序博客网 时间:2024/05/04 17:52
- 对于Android自带的tabhost组件,是位于页面顶端的,若想让其位于页面底端,在这里提供两种方法。方法一1、tabcontent和tabs交换位置2、设置tabcontent的属性:android:layout_weight="1"范例[html]<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns: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"范例[html]<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns: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"范例[html] <?xml version="1.0" encoding="UTF-8"?><RelativeLayout xmlns: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>
0 0
- 【Android】设置tabhost位于底部的三种方法
- 设置tabhost位于底部的三种方法
- 设置tabhost位于底部的三种方法
- 设置tabhost位于底部的三种方法
- 安卓开发设置Tabhost位于底部的方法
- 获得一个位于屏幕底部的tabhost
- android tabhost位于底部
- TabHost三种方法
- tabhost在窗口底部显示的方法
- Android中全屏 取消标题栏,TabHost中设置NoTitleBar的三种方法
- Android中全屏取消标题栏,TabHost中设置NoTitleBar的三种方法
- Android中全屏 取消标题栏,TabHost中设置NoTitleBar的三种方法
- Android中全屏 取消标题栏,TabHost中设置NoTitleBar的三种方法
- Flex 设置TextArea的滚动条 位于底部
- TabHost的底部实现
- 底部tabhost研究三 (TabWidget ,FrameLayout 在TabHost内。TabWidget 和FrameLayout 平行的关系)
- Android中全屏 取消标题栏,TabHost中设置NoTitleBar的三种方法(强制取消黑边)
- Android 位于底部的Tab
- debian 非SSL下 mutt 连接远程邮箱服务器
- uva10010
- Ubuntu14 中安装 VMware10 Tools工具<1>
- 详解rsync算法--如何减少网络同步文件时的网络传输量
- 线性代数之线性无关的几何上的思考
- 设置tabhost位于底部的三种方法
- 彻底解决 LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
- 队名 Booqmz 具体读音可以详见谷歌翻译声优~
- 浅谈java反射机制
- ArrayList和LinkedList区别 java
- Javascript中this对象详解
- linux系统入门
- 四川用友实习经历
- 安装Ubuntu12.04安装双系统