如何在Android中使用材质上的光波纹按钮
在我的应用程序中,有几个地方我把按钮放在深色(不是白色)背景上。在这种情况下,涟漪效应太暗而看不见。有没有办法使波纹变成白色而不是灰色?是的,有办法 创建xml(例如button.xml):如何在Android中使用材质上的光波纹按钮,android,android-layout,material-design,Android,Android Layout,Material Design,在我的应用程序中,有几个地方我把按钮放在深色(不是白色)背景上。在这种情况下,涟漪效应太暗而看不见。有没有办法使波纹变成白色而不是灰色?是的,有办法 创建xml(例如button.xml): 创建按钮\u ripple.xml: <?xml version="1.0" encoding="UTF-8" ?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape=
创建按钮\u ripple.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="200dp"
android:height="50dp"/>
<solid
android:color="@color/accent" />
</shape>
将button.xml中的android:color=“@android:color/white”更改为ripple effect所需的颜色,并将button.xml指定为按钮的背景
@颜色/重音是“正常状态”按钮的颜色。可能重复的颜色无法解释如何更改颜色,并询问应该是什么颜色。我知道我想要什么颜色,但不知道如何改变它。答案是你想要什么。
<?xml version="1.0" encoding="UTF-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<size
android:width="200dp"
android:height="50dp"/>
<solid
android:color="@color/accent" />
</shape>