菜单被遮挡,如何处理层级关系?

菜单被遮挡,如何处理层级关系?

http://img1.sycdn.imooc.com/climg//5931275b000154e622951510.jpg

如图,下面的菜单栏在图片的下面,如何将下面一条指定显示呢?http://img1.sycdn.imooc.com/climg//592fb24e0001df3e07161251.jpg

正在回答

登陆购买课程后可参与讨论,去登陆

3回答

最外层使用线性布局包裹下面的菜单栏和上面的内容就不会遮盖了。

提问者 sd_单子 2017-06-02 14:16:40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
 
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    <android.support.v4.view.ViewPager
        android:id="@+id/vpager_main_header_ad"
        android:layout_width="match_parent"
        android:layout_height="140dp">
 
    </android.support.v4.view.ViewPager>
   <include
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       layout="@layout/main_search">
   </include>
<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@mipmap/nav_header_index"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="100dp"/>
    </RelativeLayout>
    <ScrollView
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/vpager_main_header_ad"
        android:id="@+id/scrollView1">
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycleview_main_menu"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
           </android.support.v7.widget.RecyclerView>
            <View
                android:id="@+id/gray_line1"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:background="#d8dde1"
                android:layout_below="@id/recycleview_main_menu"
                android:layout_margin="20dp">
 
            </View>
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recycleview_second_menu"
                android:layout_below="@+id/gray_line1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
            </android.support.v7.widget.RecyclerView>
            <View
                android:id="@+id/gray_line2"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:background="#d8dde1"
                android:layout_below="@id/recycleview_second_menu"
                android:layout_margin="20dp">
            </View>
            <!--旅游热讯-->
            <LinearLayout
                android:id="@+id/main_tra_hot_info"
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/gray_line2"
                android:gravity="center">
                <ImageView
                    android:layout_width="100dp"
                    android:layout_height="30dp"
                    android:src="@mipmap/main_hot_news"/>
                <TextView
                    android:textColor="#000000"
                    android:layout_weight="1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="秋天真的来了,吃火锅就按这个火锅地图走!"/>
            </LinearLayout>
            <!--特价-->
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/main_tra_hot_info"
                android:layout_margin="5dp">
                <LinearLayout
                    android:orientation="horizontal"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    >
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="120dp"
                        android:background="@mipmap/main_spread1"
                        android:layout_weight="2"/>
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="120dp"
                        android:background="@mipmap/main_spread2"
                        android:layout_weight="1"
                        android:layout_marginLeft="5dp"/>
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="120dp"
                        android:background="@mipmap/main_spread3"
                        android:layout_weight="1"
                        android:layout_marginLeft="5dp"/>
                </LinearLayout>
                <ImageView
                    android:layout_marginTop="5dp"
                    android:layout_width="match_parent"
                    android:layout_height="120dp"
                    android:background="@mipmap/main_spread4"
                   />
            </LinearLayout>
 
        </RelativeLayout>
 
 
</ScrollView>
 
</LinearLayout>


提问者 sd_单子 2017-06-02 14:15:40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0" encoding="utf-8"?>
    <!--内容-->
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/container_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <!--找到上面代码有问题,正确写法在下面-->
        <!--功能菜单-->
        <LinearLayout
            android:id="@+id/container_menu"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="#ffffff"
            android:orientation="horizontal">
 
            <LinearLayout
                android:id="@+id/menu_main"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">
 
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/menu_icon_selector" />
 
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="首页"
                    android:textColor="#000000" />
            </LinearLayout>
 
            <LinearLayout
                android:id="@+id/menu_find"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">
 
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/find_icon_selector"
                    android:clickable="false" />
 
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="发现"
                    android:textColor="#000000" />
 
            </LinearLayout>
 
            <LinearLayout
                android:id="@+id/menu_me"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:orientation="vertical">
 
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/me_icon_selector" />
 
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="我的"
                    android:textColor="#000000" />
 
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!--这一块正写法-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.imooc.testend.MainActivity">
    <!--内容-->
    <RelativeLayout
        android:id="@+id/container_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1">
 
    </RelativeLayout>

虽然不懂为啥是这样写,不过总算问题解决了

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师
插入代码