【发布时间】:2017-05-19 00:04:54
【问题描述】:
我正在使用对话框片段。问题是状态栏颜色变为黑色。如何将其更改为其他颜色?这是片段内部的奇怪原因,它工作正常。它在 DialogFragment 中唯一的黑色
@Override
public void onStart() {
super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point
Dialog d = getDialog();
if (d != null) {
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
d.getWindow().setLayout(width, height);
d.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Dialog dialog = new Dialog(getActivity(), R.style.full_screen_dialog);
return dialog;
}
【问题讨论】:
标签: android colors fragment android-dialogfragment android-statusbar