在我的Android项目中,我在一种布局内使用RecyclerView。这是下面给出的代码-
<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>
现在,当用户滚动太多时,为了渲染大量数据,屏幕被挂起。因此,我想减慢滚动速度。 我尝试了以下解决方案-
How can i control the scrolling speed of recyclerView.smoothScrollToPosition(position)
它在水平滚动中效果很好,但是当我切换到垂直视图时,它不起作用。 有什么办法解决这个问题?