如何在不使用主题的情况下更改标题栏的背景颜色。 Android 中的坦克。
最佳答案
试试下面的代码
View titleView = getWindow().findViewById(android.R.id.titlebar);
if (titleView != null) {
ViewParent parent = titleView.getParent();
if (parent != null && (parent instanceof View)) {
View parentView = (View)parent;
parentView.setBackgroundColor(Color.RED);
}
}
关于android - 如何在没有主题的情况下更改标题栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6582508/