I have a TextView, what I want is to make the TextView shape circle and then set different background colors based on different conditions I have u
If you have a relatively small amout of colors, you can create a drawable file for each color, for example create a file bg_red.xml:
-
Then assign define the TextView:
Note that the width is twice the radius of the background corner radius.
To change the color from code:
TextView v = (TextView) findViewById(R.id.my_text_view);
v.setBackgroundResource(R.drawable.bg_blue);