I implement the DialogFragment below. I want the status bar color to be transparent, the status bar text color to be dark in light theme. Also the text color need to be white in dark theme.
How can I implement it?
However, I know that when clear dim flag, it can solve the question above. But I need dim!!!
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND)
public class MyDialogFragment extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
LogUtil.i(TAG, "onCreateDialog() call");
AlertDialog alertDialog = new AlertDialog.Builder(getContext(), R.style.MyDialogStyle1)
.setView(binding.getRoot())
.create();
alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
Window window = alertDialog.getWindow();
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.height = CustomViewUtil.getScreenH(getContext());
attributes.width = (int) (CustomViewUtil.getScreenW(getContext()) * 0.8);
attributes.gravity = Gravity.END;
window.setAttributes(attributes);
window.setWindowAnimations(R.style.NavigationDrawerDialogAnimation);
alertDialog.setCanceledOnTouchOutside(true);
...
return alertDialog;
}
@Override
public void onStart() {
super.onStart();
LogUtil.i(TAG, "onStart() call");
Dialog dialog = getDialog();
if (dialog != null) {
Window window = dialog.getWindow();
int width = window.getAttributes().width;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
window.setLayout(width, height);
}
}
}

Add this style.
Then add this style to your activity in app AndroidManifest.xml.