• 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>

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

  • 相关阅读:
    73. Set Matrix Zeroes (Array)
    79. Word Search (Array; DFS,Back-Track)
    59. Spiral Matrix II (Array)
    PAT 1082. Read Number in Chinese
    PAT 1067 Sort with Swap(0,*)
    LeetCode Min Stack
    LeetCode Find Minimum In Rotated Sorted Array
    PAT 1071. Speech Patterns
    PAT 1022. Digital Library
    PAT 1041. Be Unique
  • 原文地址:https://www.cnblogs.com/caoxinyu/p/6647850.html
Copyright © 2020-2023  润新知