android – 如何在带圆角的布局上添加涟漪效果?
作者:互联网
参见英文答案 > How to create ripple effect in simple layout 10个
我想在带圆角的布局上设置涟漪效果.我该怎么做?
解决方法:
使用以下代码.
<?xml version="1.0" encoding="utf-8"?>
<ripple android:color="@color/COLOR_WHILE_PRESSING" xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/round_corner"></item>
</ripple>
round_corner.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/BACKGROUND_COLOR" />
<corners android:radius="6dp" />
</shape>
标签:android,android-layout,rippledrawable 来源: https://codeday.me/bug/20190727/1552675.html