Skip to content

Commit 83c7acd

Browse files
committed
remove RelativeLayout parent for each individual RecyclerView - adds to complexity of the UI unless RelativeLayout needs to have more child views
replace ScrollView with NestedScrollView as a parent for child scrollable elements(RecyclerViews)
1 parent e1c0c71 commit 83c7acd

File tree

1 file changed

+31
-53
lines changed

1 file changed

+31
-53
lines changed

app/src/main/res/layout/activity_main.xml

Lines changed: 31 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<android.support.design.widget.CoordinatorLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
34
xmlns:app="http://schemas.android.com/apk/res-auto"
45
xmlns:tools="http://schemas.android.com/tools"
56
android:layout_width="match_parent"
@@ -28,20 +29,14 @@
2829
android:textColor="#ffffff"
2930
android:textSize="30sp" />
3031

31-
32-
<RelativeLayout
32+
<android.support.v7.widget.RecyclerView
33+
android:id="@+id/recyclerView"
3334
android:layout_width="match_parent"
34-
android:layout_height="wrap_content"
35-
android:layout_weight="1">
36-
37-
<android.support.v7.widget.RecyclerView
38-
android:id="@+id/recyclerView"
39-
android:layout_width="match_parent"
40-
android:layout_height="match_parent"
41-
android:layout_margin="16dp"
42-
android:elevation="10dp">
43-
</android.support.v7.widget.RecyclerView>
44-
</RelativeLayout>
35+
android:layout_height="match_parent"
36+
android:layout_margin="16dp"
37+
android:elevation="10dp"
38+
android:orientation="horizontal">
39+
</android.support.v7.widget.RecyclerView>
4540

4641
<TextView
4742
android:layout_width="match_parent"
@@ -53,20 +48,14 @@
5348
android:textColor="#ffffff"
5449
android:textSize="30sp" />
5550

56-
57-
<RelativeLayout
51+
<android.support.v7.widget.RecyclerView
52+
android:id="@+id/recyclerView1"
5853
android:layout_width="match_parent"
59-
android:layout_height="wrap_content"
60-
android:layout_weight="1">
61-
62-
<android.support.v7.widget.RecyclerView
63-
android:id="@+id/recyclerView1"
64-
android:layout_width="match_parent"
65-
android:layout_height="match_parent"
66-
android:layout_margin="16dp"
67-
android:elevation="10dp">
68-
</android.support.v7.widget.RecyclerView>
69-
</RelativeLayout>
54+
android:layout_height="match_parent"
55+
android:layout_margin="16dp"
56+
android:elevation="10dp"
57+
android:orientation="horizontal">
58+
</android.support.v7.widget.RecyclerView>
7059

7160
<TextView
7261
android:layout_width="match_parent"
@@ -78,20 +67,14 @@
7867
android:textColor="#ffffff"
7968
android:textSize="30sp" />
8069

81-
82-
<RelativeLayout
70+
<android.support.v7.widget.RecyclerView
71+
android:id="@+id/recyclerView2"
8372
android:layout_width="match_parent"
84-
android:layout_height="wrap_content"
85-
android:layout_weight="1">
86-
87-
<android.support.v7.widget.RecyclerView
88-
android:id="@+id/recyclerView2"
89-
android:layout_width="match_parent"
90-
android:layout_height="match_parent"
91-
android:layout_margin="16dp"
92-
android:elevation="10dp">
93-
</android.support.v7.widget.RecyclerView>
94-
</RelativeLayout>
73+
android:layout_height="match_parent"
74+
android:layout_margin="16dp"
75+
android:elevation="10dp"
76+
android:orientation="horizontal">
77+
</android.support.v7.widget.RecyclerView>
9578

9679
<TextView
9780
android:layout_width="match_parent"
@@ -104,19 +87,14 @@
10487
android:textSize="30sp" />
10588

10689

107-
<RelativeLayout
90+
<android.support.v7.widget.RecyclerView
91+
android:id="@+id/recyclerView3"
10892
android:layout_width="match_parent"
109-
android:layout_height="wrap_content"
110-
android:layout_weight="1">
111-
112-
<android.support.v7.widget.RecyclerView
113-
android:id="@+id/recyclerView3"
114-
android:layout_width="match_parent"
115-
android:layout_height="match_parent"
116-
android:layout_margin="16dp"
117-
android:elevation="10dp">
118-
</android.support.v7.widget.RecyclerView>
119-
</RelativeLayout>
93+
android:layout_height="match_parent"
94+
android:layout_margin="16dp"
95+
android:elevation="10dp"
96+
android:orientation="horizontal">
97+
</android.support.v7.widget.RecyclerView>
12098

12199
</LinearLayout>
122100

@@ -131,7 +109,7 @@
131109
app:itemIconTint="@android:color/white"
132110
app:itemTextColor="@android:color/white"
133111
app:layout_behavior="com.example.dhananjay.dailygoals.BottomNavigationBehavior"
134-
app:menu="@menu/navigation" />
112+
app:menu="@menu/navigation"/>
135113

136114

137115
</android.support.design.widget.CoordinatorLayout>

0 commit comments

Comments
 (0)