我有以下几点:
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
我将其添加为更简洁的用户界面:
android:paddingEnd="16dp"
android:paddingStart="16dp"
但是,现在滚动条位于填充内,看上去很时髦。因此,我添加:
android:scrollbarStyle="outsideInset"
滚动条现在位于填充的外部,但是,过度滚动发光仍位于填充的内部。
如何获得滚动上的光晕以在填充上延伸?
编辑:
这是遇到与上述相同问题的完整布局代码。
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
最佳答案
您需要做的是将android:clipToPadding="false"
应用于RecyclerView
。考虑以下xml:
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="40dp"
android:paddingBottom="40dp"
android:clipToPadding="false"/>
结果如下: