0

In My Android project I am using RecyclerView inside one layout. Here is the code given below-

<RelativeLayout 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"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    tools:context=".ui.reader.pageview.PageViewFragment">
    <TextView
        android:id="@+id/tv_test"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <android.support.v7.widget.RecyclerView
        android:overScrollMode="never"
        android:id="@+id/rv_page_view"
        android:layout_below="@id/pb"
        android:layout_above="@+id/ll_page_controller_bottom"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </android.support.v7.widget.RecyclerView>

    <LinearLayout
        android:background="@color/colorWhite"
        android:orientation="vertical"
        android:id="@+id/ll_page_controller_bottom"
        android:layout_alignParentBottom="true"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <View

            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#DADADA" />

        <org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
            android:layout_marginStart="5dp"
            android:layout_marginEnd="5dp"
            android:id="@+id/seek_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:dsb_indicatorColor="@color/colorOrange"
            app:dsb_trackColor="@color/colorOrange"
            app:dsb_progressColor="@color/colorOrange"
            app:dsb_rippleColor="@color/colorGray"
            app:dsb_min="0"
            app:dsb_max="100"/>

        <TextView
            android:layout_marginTop="-10dp"
            android:layout_marginBottom="5dp"
            android:text="1"
            android:id="@+id/tv_page_number"
            android:layout_gravity="center"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <View
        android:layout_below="@id/pb"
        android:layout_above="@id/ll_page_controller_bottom"
        android:id="@+id/view_touch"
        android:layout_width="match_parent"
        android:layout_height="match_parent"

        />

    <RelativeLayout
        android:visibility="invisible"
        android:id="@+id/rl_settings"
        android:layout_alignParentEnd="true"
        android:layout_below="@id/pb"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <include layout="@layout/reader_settings"/>
    </RelativeLayout>

    <TextView
        android:layout_margin="10dp"
        android:layout_below="@id/pb"
        android:id="@+id/tv_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:textSize="16sp"
        android:visibility="invisible"
        android:layout_above="@id/ll_page_controller_bottom"/>

</RelativeLayout>

Now, for rendering a lot of data when the users scrolls too much fast the screen got hanged. So, I want to slow down the speed of the scrolling. I have tried the following solution-

How can i control the scrolling speed of recyclerView.smoothScrollToPosition(position)

It works well with horizontal scrolling but when I switch to vertical view then It doesn't work. Is there any way to solve this?

S. M. Asif
  • 3,437
  • 10
  • 34
  • 58

0 Answers0