【发布时间】:2016-10-14 09:21:59
【问题描述】:
我的问题是我想更改特定片段中状态栏的颜色。在所有其他片段中颜色应该相同。例如在所有片段中我的状态栏颜色是红色。但在特定片段中我想把它改成黑色。谁能告诉我该怎么做?
这是我的片段的 onCreateView 方法:-
@Override
public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) {
final View view = (View) inflater.inflate(R.layout.slide_user_image, container, false);
Window window = getActivity().getWindow();
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(getActivity().getResources().getColor(R.color.black));
return view;
}
【问题讨论】:
-
最好的部分是使用主题。
标签: android android-fragments android-statusbar