Recyclerview 列表结束覆盖颜色和 alpha

Man*_*yal 2 android listview android-recyclerview

即使我们到达列表的末尾(顶部或底部),当我们尝试滚动时,如何更改 recyclerview 上的灰色或白色叠加层。我找不到可以用来执行此操作的属性名称。

Nil*_*hod 5

RecyclerView从取影colorPrimary的主题。

您需要创建新主题,RecyclerView然后将此主题应用到您的RecyclerView

在下面的示例主题 colorPrimarycolorGreen,它将采用绿色阴影。

示例代码

<android.support.v7.widget.RecyclerView
     android:id="@+id/ha_citiesRC"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_marginTop="10dp"
     android:requiresFadingEdge="vertical"
     android:theme="@style/CustomTheme"
     android:nestedScrollingEnabled="false" />
Run Code Online (Sandbox Code Playgroud)

主题

 <style name="CustomTheme" parent="Theme.AppCompat.Light.DarkActionBar">

   <item name="colorPrimary">@color/colorGreen</item>
   <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
   <item name="colorAccent">@color/colorAccent</item>

 </style>
Run Code Online (Sandbox Code Playgroud)