android - Change color of button -
How do I change the color of a button using XML files? I tried to use : android: background = "@ android: color / black" but it works only for black and white as much as I can tell. Can someone explain this to me. Why not
android: background = "@ android: color / blue" ?
& lt; item android: state_pressed = "true" & gt; & Lt; Size & gt; & Lt; Shield Android: startColor = "@ android: Color / Yellow" Android: endColor = "@ Android: Color / Yellow" Android: Angle = "270" /> & Lt; Stroke Android: width = "3dp" Android: Color = "@Android: Color / Gray" /> & Lt; Corners Android: Radius = "3dp" /> & Lt; padding android: left = "10dp" Android: top = "10dp" Android: right = "10dp" Android: bottom = "10dp" /> & Lt; / Size & gt; & Lt; / Item & gt; & Lt; Android Android: state_focused = "true" & gt; & Lt; Size & gt; & Lt; Shield Android: endColor = "@ android: color / orange" Android: startColor = "@Android: Color / Orange" Android: Angle = "270" /> & Lt; Stroke Android: width = "3dp" Android: Color = "@Android: Color / Gray" /> & Lt; Corners Android: Radius = "3dp" /> & Lt; padding android: left = "10dp" Android: top = "10dp" Android: right = "10dp" Android: bottom = "10dp" /> & Lt; / Size & gt; & Lt; / Item & gt; & Lt; Items & gt; & Lt; Size & gt; & Lt; Shield Android: endColor = "@ android: color / blue" Android: startColor = "@ Android: Color / Blue" Android: Angle = "270" /> & Lt; Stroke Android: width = "3dp" Android: Color = "@Android: Color / Gray" /> & Lt; Corner Android: Radius = "3dp" /> & Lt; padding android: left = "10dp" Android: top = "10dp" Android: right = "10dp" Android: bottom = "10dp" /> & Lt; / Size & gt; & Lt; / Item & gt; For example, name the file custom_button.xml, then in the actual button:
background = "@ drawable / referenced from custom_button "
Comments
Post a Comment