1 layout file
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sv_home_hm" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:scrollbars="none"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_home_model_type" android:layout_width="match_parent" android:layout_height="65dp" android:layout_marginTop="16dp"></androidx.recyclerview.widget.RecyclerView> <androidx.recyclerview.widget.RecyclerView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp"></androidx.recyclerview.widget.RecyclerView> </LinearLayout> </ScrollView>
As shown, there is a project company to use two RecyclerView interface implemented vertically arranged from top to bottom;
My layout is custom ScrollerView sets LinearLayout sets RecyclerView;
Debug interface, we found the third RecyclerView show there is a problem, what we call display incomplete;
Interface obviously a lot of data returned, I tried many methods will not work, did not achieve the desired results;
Later, my solution is to RecyclerView outer nested linear layouts (LinearLayout) into the relative layout (RelativeLayout), just fine, as follows:
This is the reason vertical conflict
<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/sv_home_hm" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:scrollbars="none"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_home_model_type" android:layout_width="match_parent" android:layout_height="65dp" android:layout_marginTop="16dp"></androidx.recyclerview.widget.RecyclerView> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recycler_home_model_recommend" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp"></androidx.recyclerview.widget.RecyclerView> </RelativeLayout> </ScrollView>