开发者

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

开发者 https://www.devze.com 2022-12-22 04:36 出处:网络
This question already has answers here: 开发者_如何学编程 Closed 10 years ago. Possible 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

精彩评论

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