I create a drawable.xml for some purpose , and i want to use this color:#29395e.
But i can't set up the #29395e in android:drawable .
I try to use <item android:color=" #29395e"/>
, it can't compile.
Is any way i can use this color #29395e in this drawable ?
Any help will be grateful.
here is my drawable.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/corner_with_tab" android:state_selected="true" />
<item android:drawable="@android:color/holo_blue_light"/>
</selector>
Use app:drawableTint="@color/yourColor" in the xml instade android:drawableTint="@color/yourColor" .
android.graphics.drawable.ColorDrawable. A specialized Drawable that fills the Canvas with a specified color. Note that a ColorDrawable ignores the ColorFilter. It can be defined in an XML file with the <color> element.
Search for and select Open App, and then, on the New Shortcut page, tap Choose. Locate the app whose appearance you want to change. Back on the New Shortcut page, you'll see the app name; tap More (three dots), change the app's name, tap its icon, select Color, and choose a new color.
Make a "colors.xml" resource file in res/values folder
<resources>
<color name="colorName">#4da6ff</color>
</resources>
now in your mydrawable file use that color like this
<item
android:state_checked="true"
android:drawable="@color/colorName" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With