Android RecyclerView修改顶部、底部阴影颜色

RecyclerView滑动到顶部或者底部时,会有阴影效果,默认情况下是白色的,但有时候项目内有特殊需求时,需要其他颜色,只需要将color中的<color name="colorPrimary">自定义颜色</color> 此属性做修改即可。

我的使用模式是将AndroidManifest.xml中Application的主题替换了,重写了一个主题继承原来使用的主题,在主题内重定义了colorPrimary属性的值

原有:

AndroidManifest.xml:

<application
        android:name="***Application"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:persistent="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">

显示效果:

现在:

res/values/style.xml:

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/textSelect</item>   <!--@color/textSelect :#D44A2E-->
    </style>

AndroidManifest.xml:

<application
        android:name="***Application"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:persistent="true"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

效果:

随缘记录Ⅱ

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值