KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a button with the background defined in xml. I would like to tint the button based on the current state it is in - ie - pressed, focussed, normal. Here is my xml file below. Also, my colored_tint_dark , and colored_tint are both translucent colors that I am trying to draw over the drawable image that I call from the resources folder. Here is the problem. When the UI first loads, the image has the appropriate tint on it, but after pressed, the pressed state doesn't show any tint, then the normal state won't show any tint. <?xml version="1.0" encoding="utf-8"?> <item android:state_pressed="true" android:drawable="@drawable/rounded_grayscale_pinstripe_button"> <shape> <gradient android:endColor="@color/colored_tint" android:startColor="@color/colored_tint" android:angle="270" /> <stroke android:width="0dp" android:color="@color/colored_tint" /> <corners android:radius="0dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item android:state_focused="true" android:drawable="@drawable/rounded_grayscale_pinstripe_button"> <shape> <gradient android:endColor="@color/colored_tint" android:startColor="@color/colored_tint" android:angle="270" /> <stroke android:width="0dp" android:color="@color/colored_tint" /> <corners android:radius="0dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item android:drawable="@drawable/rounded_graysc
Tags (comma-separated)
Save Edits
Cancel