RelativeLayout 深入理解

今天做app底部的导航栏,就是会有一个分割线,分割内容和下面的fragmenttablehost,那条线,我看开源中国是用relativelayout包裹的。
我也包裹,但是不行。显示不出来那条线。
后来我意识到是顺序的问题,也就是fragmenttablehost在下面,就会把上面的view那一层覆盖掉,导致出现不了分隔栏。

总之:

 <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="@color/white"

        >


    <com.chinaCEB.cebActivity.widget.MyFragmentTabHost
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@android:id/tabhost"
        android:background="@color/white"
        android:layout_marginTop="5dp"
        >
    </com.chinaCEB.cebActivity.widget.MyFragmentTabHost>

        <View
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:background="#CCCCCC"


            >

        </View>
    </RelativeLayout>

 <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="@color/white"

        >
         <View
            android:layout_width="match_parent"
            android:layout_height="1px"
            android:background="#CCCCCC"


            >

        </View>


    <com.chinaCEB.cebActivity.widget.MyFragmentTabHost
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@android:id/tabhost"
        android:background="@color/white"
        android:layout_marginTop="5dp"
        >
    </com.chinaCEB.cebActivity.widget.MyFragmentTabHost>


    </RelativeLayout>

显示效果不一样。学习的时候知道,开发的时候不注意真的不知道 。

posted @ 2016-06-20 00:35  有点理想的码农  阅读(392)  评论(0编辑  收藏  举报