Setbackgroundcolor trong Android

Thiết lập màu nền lập trình của Android TextViewdường như không hoạt động. Tôi đang thiếu thứ gì đó!

TextView et = new TextView[activity]; et.setText["350"]; et.setBackgroundColor[R.color.white];

Tôi cũng có tệp này [colors.xml] trong thư mục res / value của mình

#ffffffff #ff000000

[EDIT]: Ngoài ra, việc đặt màu văn bản sẽ khiến TextView biến mất.

TextView c1 = new TextView[activity]; c1.setTextColor[R.color.solid_red]; c1.setText["My Text"];

Chủ Đề