UMA*_*MAR 6 layout android android-activity
可能重复:
设置标题背景颜色
如何在Android应用中更改标题栏颜色?
我试过了:
this.setTitleColor(Color.BLUE);
Run Code Online (Sandbox Code Playgroud)
但它改变了书面文字的颜色而不是标题栏颜色.
Context的getWindow()方法返回当前视图上下文,用于获取Activity的标题栏,android.id.id.title
View title = getWindow().findViewById(android.R.id.title);
View titleBar = (View) title.getParent();
titleBar.setBackgroundColor(Color.RED);`
Run Code Online (Sandbox Code Playgroud)