I'm trying to hide the navigation bar, using methods I've found described on the internet.
I have a simple layout which shows a WebView:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/layout" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
The code that I'm using at app startup is:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
web.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
But this doesn't hide the navigation bar.
I've added...
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
... to my activity too.
How can I achieve this?
you can hide the navigationbar,try this
public void FullScreencall() {
if(Build.VERSION.SDK_INT < 19) //19 or above api
View v = this.getWindow().getDecorView();
v.setSystemUiVisibility(View.GONE);
} else {
//for lower api versions.
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With