android - Changing XML color from java code -


I want a button size as a circle, which I call my Java file

I dont want to use circular images which will fulfill it because I want to possibly use any hex color and I still need to change many images.

I've created a XML file named Roundabutan, which displays a round button using the scope of the corner, but I have the color attribute ( android: color = " # Ff0000 "My Java

displays the round button right now but only, the color I have set in the xml file is displayed if I use from buttonname.setBackgroundColor for example) (Color.rgb (0, 255, 0)); The circle will be replaced by a square, so the XML color attribute will be used if I can replace it with .java !

Im changing the color of this round button on the press of any other button.

Hope this makes sense, thanks in advance!

XML Circle:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Size xmlns: Android = "http://schemas.android.com/apk/res/android" Android: Shape = "Rectangle" & gt; & Lt; Solid Android: Color = "# FF0000" /> & Lt; & Lt; & Lt; & Lt; Need to change the color code from inside of Java & lt; Corners Android: bottomRightRadius = "45dp" Android: bottomLeftRadius = "45dp" Android: topRightRadius = "45dp" Android: topLeftRadius = "45dp" / & gt; & Lt; / Size & gt; Text after the  

Create another color and use file using another size xml .setBackgroundColor (GetResources (.) GetColor (R.color.your_color_in_xmlfile));


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -