-1

Here is an XML, when I am using ScrollView below_recycler_view RecyclerView is not appearing, without using ScrollView inside an xml below_recycler_view appears

So what could be the reason ?

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <include android:id="@+id/toolbar" layout="@layout/toolbar_main" /> <LinearLayout android:layout_width="match_parent" android:layout_below="@+id/toolbar" android:id="@+id/lind" android:layout_height="wrap_content"> ..... </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/lind" android:id="@+id/linearLayout2" android:layout_marginTop="10dp" android:gravity="center_horizontal" android:orientation="horizontal"> ..... </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_marginTop="5dp" android:id="@+id/linearLayout3" android:layout_below="@+id/linearLayout2" android:orientation="horizontal"> ..... </LinearLayout> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollbars="none" android:layout_below="@+id/linearLayout4" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/linearLayout4" android:orientation="horizontal" android:layout_marginLeft="5dp" android:layout_marginRight="10dp" android:layout_below="@+id/linearLayout3" android:layout_alignParentLeft="true" android:layout_alignParentStart="true"> ...... </RelativeLayout> <android.support.v7.widget.RecyclerView android:id="@+id/below_recycler_view" android:layout_width="match_parent" android:layout_below="@+id/my_recycler_view" android:layout_height="wrap_content" android:scrollbars="none" /> </RelativeLayout> </ScrollView> </RelativeLayout> 
3
  • you cant put recyclerview or listview in scrollview. again scrollview only takes one direct child. Commented Mar 1, 2016 at 10:48
  • to use recyclerview inside scrollview you have to create your own layout manager check this stackoverflow.com/questions/32420770/… Commented Mar 1, 2016 at 10:49
  • I am using two recyclerviews inside ScrollView - one horizontal and second vertical.. and the issue is it hides Vertical RecyclerView Commented Mar 1, 2016 at 10:50

1 Answer 1

-1

You can't put ListView/RecycleView inside ScrollView. When ListView and RecycleView trying to calculate their height, they are using parent height. ScrollView doesn't have a speciefed height, so it gives an error.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.