我正在尝试使用涟漪效应和选择器(聚焦、悬停、禁用等)来实现Button
( AppCompatButton
)。我创建了如下所示的 drawable.xml:
<ripple android:color="#rippleColor">
<item><shape android:shape="rectangle">...</shape>
<item>
<selector>
<item android:state_enabled="false">
<shape>...</shape>
</item>
<item android:state_focused="true">
<shape>...</shape>
</item>
...another states...
</selector>
<item>
</ripple>
此代码有效,但如果使用 d-pad 或光标导航,何时Button
聚焦或悬停,而不是选择器中的颜色,则使用波纹颜色。