涟漪效应的颜色变化

问题描述 投票:1回答:2

我有一个ListView其中背景是黑色的。现在我的问题是,默认的连锁反应也是黑色,用户不能真正看到它。

我怎样才能改变涟漪效应,而不依赖于API级别的颜色吗? (我想实现白色)。

android xml layout ripple
2个回答
2
投票

您可以设置此为您的看法背景:

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?android:attr/colorAccent">
<item android:id="@android:id/mask">
    <color android:color="#42ffffff" />
</item>

欲了解更多详细信息,请参阅计算器这个问题:

What should be the color of the Ripple, colorPrimary or colorAccent? (Material Design)

你可以使用这个库为低的API:

https://github.com/traex/RippleEffect


0
投票

在styles.xml:“colorControlHighlight项目”与所需的颜色只需添加

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorControlHighlight">@color/white</item>
</style>
© www.soinside.com 2019 - 2024. All rights reserved.