Ich möchte die Farbe der Schaltfläche ändern. Sagen wir: Blau. Wie können wir Farbe der Schaltfläche in ripple.xml
Datei hinzufügen, die eigentlich die Eigenschaften der Schaltfläche ist? Aus dem unten stehenden Code ist die Farbe der Schaltfläche transparent.Ändern Sie die Farbe der Schaltfläche (erscheint) in Schaltflächeneigenschaften, wenn die Schaltfläche Ripple-Effekt hat
Knopf in content_main.xml
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ripple"
android:text="Hello World!" />
ripple.xml
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#f816a463"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#f816a463" />
</shape>
</item>
</ripple>
Edit1
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#16a463"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#16a463" />
</shape>
</item>
</ripple>
Verwenden Sie '# 16a463' sechsstellig für die Farbe. 8 Ziffern enthalten Farbe mit transparenter Farbe. – sushildlh
@sushildlh Wo Hintergrundfarbe hinzufügen? – Humty
in der ripple.xml 'android: color =" # 16a463 "' verwenden Sie hier blauen Farbcode in nur 6 Ziffern .... – sushildlh