How to make TextView shape circle and set different background color based on condition

后端 未结 5 1199
死守一世寂寞
死守一世寂寞 2020-12-08 08:09

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

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-08 08:22

    You can also achieve this by setting color to background drawable like this

    TextView textView = (TextView) findViewById(R.id.my_text_view);
    ((GradientDrawable)textView.getBackground()).setColor(R.color.my_color);
    

提交回复
热议问题