ScrollView does not throw. Scroll slowly

I have the following layout:

<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="?android:attr/actionBarSize" android:fillViewport="true"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:id="@+id/datatransfer_measure_list_layout_no_data" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/datatransfer_measure_list_textview_no_data" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="20dp" android:layout_marginEnd="40dp" android:layout_marginStart="40dp" android:layout_marginTop="20dp" android:gravity="center" android:padding="5dp" android:text="@string/measure_data_empty" android:textColor="@color/textcolorprimary" android:textSize="18sp" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:layout_gravity="center" android:layout_marginBottom="20dp" android:layout_marginEnd="20dp" android:layout_marginStart="20dp" android:background="@android:color/darker_gray" android:importantForAccessibility="no" /> </LinearLayout> <android.support.v7.widget.RecyclerView android:id="@+id/datatransfer_measure_list_row_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="15dp" android:clipToPadding="false" android:importantForAccessibility="no" android:paddingBottom="5dp" android:textColor="@color/textcolorprimary" /> <Button android:id="@+id/datatransfer_measure_list_button_send" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="10dp" android:layout_marginEnd="40dp" android:layout_marginStart="40dp" android:background="@drawable/custom_button_ok" android:gravity="center" android:padding="10dp" android:text="@string/common_save" android:textColor="@drawable/custom_button_positive_text_color" android:textSize="20sp" /> <Button android:id="@+id/datatransfer_measure_list_button_reset" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginBottom="20dp" android:layout_marginEnd="40dp" android:layout_marginStart="40dp" android:background="@drawable/custom_button_cancel" android:gravity="center" android:padding="10dp" android:text="@string/common_cancel" android:textColor="@drawable/custom_button_negative_text_color" android:textSize="20sp" /> </LinearLayout> </ScrollView> 

I basically have three parts of this layout. First, a layout containing only a text view to show if data is installed. It becomes invisible when there is data.

The second part is my recyclerview, which appears only when some data is installed.

The last part is two buttons. My problem with this layout? Scrolling is very slow. I do not mean a lag or something like that. I can just scroll a small part. This is not like my other scrollviews, where I can drop the view so that it scrolls automatically. I have no idea what is different from this layout and why scrollview works here and then in my other layouts. Is there something that blocks scroll scrolling or something like that?

+5
source share
1 answer

Your Recyclerview collides with ScrollView , so the scroll is not smooth.

Try disabling recyclerview scrolling.

 RecyclerView recyclerView = (RecyclerView)findViewById(R.id.datatransfer_measure_list_row_parent); recyclerView.setNestedScrollingEnabled(false) 
+13
source

All Articles