2010-03-05 108 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