How do I remove the navigation bar to get Full Screen View?
So far I've tried setting the theme using:
<style name="AppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
and
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
in styles.xml
and
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
in activity_main.xml
and i also tried
ActionBar ac = getSupportActionBar();
ac.hide();
even tried
requestWindowFeature(Window.FEATURE_NO_TITLE);
in my MainActivity.java but this only made action bar to disappear. I have
been trying for a few days now but can't figure this out.
Try! call it in onCreate()
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
And
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}
}
you need fullscreen layout try this:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN
);
add it in the onCreate of the Activity that you wanted to see fullscreen.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.