我有一个带有连锁效果的按钮,它有两种状态 一个是“常规”的涟漪效应,另一个是选中的 背景发生了变化,但有两个问题:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@color/cal_selected"/>
<item android:drawable="@drawable/cal_day_regualr">
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:attr/colorActivatedHighlight">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="@color/cal_background" />
</shape>
</item>
</ripple>
</item>
</selector>
答案 0 :(得分:0)
我设法通过向选定状态添加另一个波纹来实现此目的 请参阅以下代码:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<ripple android:color="@color/cal_selected_ripple">
<item>
<shape android:shape="oval">
<solid android:color="@color/cal_selected" />
</shape>
</item>
</ripple>
</item>
<item>
<ripple android:color="?android:attr/colorActivatedHighlight">
<item android:id="@android:id/mask">
<shape android:shape="oval">
<solid android:color="@color/cal_background" />
</shape>
</item>
</ripple>
</item>
</selector>