Vla*_*ian 3 java android android-listview android-recyclerview
我有一个 RecyclerView。我需要设置 overScrollMode = "never" 的值来删除此动画,但同时禁用 fadingEdge 选项。你能帮我关闭我上面写的动画,而不禁用 fadingEdge 吗?
解决方案
如果您在 XML 中执行此操作,那么当您禁用 OverScrollMode - 淡入淡出也将变得无法访问,但如果您以编程方式执行此操作,则一切都会正常。
recyclerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
recyclerView.setVerticalFadingEdgeEnabled(true);
recyclerView.setFadingEdgeLength(Math.round(30 * Resources.getSystem().getDisplayMetrics().density));
Run Code Online (Sandbox Code Playgroud)
解决方案2
@RakeshKumar 提出了一个使用 XML 的选项。为了让淡入淡出不消失,还必须为RecyclerView指定背景。
android:background="YOUR COLOR"
android:fadingEdgeLength="30dp"
android:requiresFadingEdge="vertical"
android:overScrollMode="never"
Run Code Online (Sandbox Code Playgroud)
您可以像下面这样使用它:
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:overScrollMode="never"
android:background="#ffffff"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fadingEdgeLength="30dp"
android:requiresFadingEdge="vertical"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1052 次 |
| 最近记录: |