2010-03-05 112 views

回答

6

getWindow()語境方法返回當前視圖上下文,用於得到一個活動的標題欄,android.id.id.title

View title = getWindow().findViewById(android.R.id.title); 
View titleBar = (View) title.getParent(); 
titleBar.setBackgroundColor(Color.RED);` 
+1

它不適用於我........給出了運行時錯誤 – 2014-04-29 05:39:35

+1

java.lang.NullPointerException – vNext 2014-12-09 05:18:38

+0

@vNext你能解決這個錯誤嗎? – mrid 2017-11-30 07:04:53