FragmentTabHost 布局

在网上看了很多demo   但是自己用起来都报错了,今天纠结了一天   刚才才试出来  现在贴上我自己的布局文件  

正在学习FragmentTabHost 的可以参考一下

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<FrameLayout
android:id="@+id/realtabcontent"  //注意看这两个地方  ,网上的demo都只在外面定义了一个FrameLayout 我使用总是报错,我就在FragmentTabHost 里面再定义一个FrameLayout  ID 都是一样的

android:layout_width="match_parent"  //居然可以使用了,表示今天都有弄这个   头大了一天   也没明白这是什么原理,先拿着使用吧。
android:layout_height="0dp"
android:layout_weight="1" />

<android.support.v4.app.FragmentTabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<FrameLayout    //在FragmentTabHost 中重新定义了FrameLayout   ID 不变
android:id="@id/realtabcontent"
android:layout_width="0dp"
android:layout_height="0dp" />

<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp" />
</android.support.v4.app.FragmentTabHost>

</LinearLayout>

转载于:https://www.cnblogs.com/lqs2015/p/4755338.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值