开发者

How to change title bar color in android activity? [duplicate]

This question already has answers here: 开发者_如何学编程 Closed 10 years ago.

Possible Duplicate:

Set title background color

How can I change the titlebar color in an Android app?

I tried:

this.setTitleColor(Color.BLUE); 

but it changes color of written text on it not title bar color.


getWindow() method of Context return the current view context, for get the title bar of an Activity, android.id.id.title

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜