Android的“bug”(一)

学了好久,原来是被Android的几个bug搞得分不清方向了! 
android.support.v4.app.FragmentTabHost这个东西有点bug,原因是3.0留下的问题,而为了兼容性,所以3.0以后的不再(官方推荐)使用TabActivity这变态东西,推荐使用Fragment代替,因而tabcontent随之废弃掉(不是真正的废弃)。二网上还有很多关于Tabactivity过时的例子。要想使用tabhost这个功能,并使用fragmen,因而有以下这个变态的布局:

<span style="font-family: Arial, Helvetica, sans-serif;">
</span>
<span style="font-family: Arial, Helvetica, sans-serif;"><android.support.v4.app.FragmentTabHost</span>
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <LinearLayout
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <span style="color:#ff0000;"><FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="0"/></span>
        <FrameLayout
                android:id="@+id/realtabcontent"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"/>
        <TabWidget
                android:id="@android:id/tabs"
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0"/>
    </LinearLayout>
</android.support.v4.app.FragmentTabHost>


(红色字段,看到没?   android:layout_width="0dp"    android:layout_height="0dp"    android:layout_weight="0"/ 只能设置为0,也就是说把这个 tabcontent过时的老家伙强制隐藏掉 )。

希望Android的下一个bug不要这么蛋疼!!! 
有时候一连几天在学习那个BUG!学到你想崩溃,但有不能崩溃的境界        

真的是要:苦其心志劳其筋骨饿其体肤、空乏其身、行拂乱其所为、所以动心忍性增益其所不能。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值