2012-01-13 31 views
5

將TextView backgroundColor設置爲我想要的任何內容後。如何將TextView背景顏色更改爲初始值

Fri2030 =(TextView)findViewById(R.id.tvFri2030); Fri2030.setBackgroundColor(Color.BLUE);

如何清理TextView backgroundColor如果我不想要任何顏色並初始化它。 (不想被其他顏色覆蓋)

thx的幫助!

+2

不明確的問題。你到底想做什麼?你想添加或不添加顏色。如果不只是評論該代碼 – 2012-01-13 08:32:45

+1

@ Rashmi.B:他想要恢復默認顏色,如果事情動態發生。評論代碼不是解決方案。 – Sameer 2012-01-13 08:40:33

+0

if(condition){set this color} else if(condition){set this color}這就是我所能說的。我仍然不清楚他想要什麼 – 2012-01-13 08:43:12

回答

3

願這幫助你......一旦存儲所有這些價值,後來當你需要它 然後用它們上---

 TextView text=new TextView(this); 
    text.getCurrentHintTextColor(); 
    text.getCurrentTextColor(); 
    text.getDrawingCacheBackgroundColor(); 
7
setBackgroundColor(android.R.color.transparent);