Recyclerview列表结束叠加颜色和Alpha [英] Recyclerview list end overlay color and alpha

查看:116
本文介绍了Recyclerview列表结束叠加颜色和Alpha的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们尝试滚动时,即使到达列表的末尾(顶部或底部),如何更改recyclerview上的灰色或白色覆盖层.我找不到可以用来做的属性名称.

How can I change the grey or white overlay that comes on recyclerview when we try to scroll even when we reached the end(top or bottom) of list. I am not able to find the property name to which I can use to do it.

推荐答案

RecyclerView从主题的colorPrimary中获取阴影.

The RecyclerView take the shadow from the colorPrimary of your Theme.

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

You need to create new theme for RecyclerView then apply this Theme to your RecyclerView

在下面的示例中,主题colorPrimarycolorGreen,因此它将带有绿色阴影.

In below example themes colorPrimary is colorGreen so it will take green color shadow.

示例代码

<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" />

主题

 <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>

这篇关于Recyclerview列表结束叠加颜色和Alpha的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆