我在FullScreen活动中实现了模态底部片段片段。问题是,当我显示片段时,会出现导航栏。这是我显示片段的代码:
OptionsFragment optionsFragment=OptionsFragment.newInstance();
optionsFragment.show(getSupportFragmentManager(),"options_fragment");
这是片段:
public class OptionsFragment extends BottomSheetDialogFragment {
public OptionsFragment() {
}
public static OptionsFragment newInstance() {
OptionsFragment fragment = new OptionsFragment();
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.options_layout,container,false);
return view;
}
}
最后,这就是我在活动开始时隐藏工具栏和导航栏的方法:
mContentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);