可能是重复问题:
设置标题背景颜色
我如何在Android应用程序中更改标题栏颜色?
我尝试过:
this.setTitleColor(Color.BLUE);
但是它改变的是其上书写文本的颜色,而不是标题栏的颜色。
可能是重复问题:
设置标题背景颜色
我如何在Android应用程序中更改标题栏颜色?
我尝试过:
this.setTitleColor(Color.BLUE);
Context的getWindow()方法返回当前视图上下文,用于获取Activity的标题栏,android.id.id.title。
View title = getWindow().findViewById(android.R.id.title);
View titleBar = (View) title.getParent();
titleBar.setBackgroundColor(Color.RED);`