Setting the background color programatically of an android TextView
doesn't seem to work.
I'm I missing something!
TextView et = new TextView(activity);
et.setText("350");
et.setBackgroundColor(R.color.white);
I also have this file (colors.xml) in my res/values folder
<resources>
<color name="white">#ffffffff</color>
<color name="black">#ff000000</color>
</resources>
[EDIT]:
Also, setting the text color causes the TextView to disappear.
TextView c1 = new TextView(activity);
c1.setTextColor(R.color.solid_red);
c1.setText("My Text");
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…