Android:您可以使用默认状态颜色为透明的涟漪效果吗? [英] Android: can you have a ripple effect whose default state color is transparent?

查看:119
本文介绍了Android:您可以使用默认状态颜色为透明的涟漪效果吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似以下内容,但无效。如果将可绘制的颜色切换为蓝色,则可以使用。

Something like the following, but it doesn't work. If I switch the drawable color to something like blue, it works.

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?android:colorControlHighlight">
    <item android:drawable="@android:color/transparent"/>
</ripple>


推荐答案

有必要添加一个蒙版:

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
    android:color="?android:colorControlHighlight">
     <item android:id="@android:id/mask">
       <color android:color="@android:color/white" />
     </item>
</ripple>

这篇关于Android:您可以使用默认状态颜色为透明的涟漪效果吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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