I have a project in which i want to make the Layouts
FullScreen
or make the Android Soft
keys hidden.
I tried solutions by Googling like
Theme.AppCompat.Light.NoActionBar
I disabled Back
Key using this code :
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if(keyCode == KeyEvent.KEYCODE_HOME)
{
Log.i("Home Button", "Clicked");
}
if(keyCode==KeyEvent.KEYCODE_BACK)
{
finish();
}
return false;
};
But i want to disable all Soft Keys or Hide them.
Note that the device in which my app will work is Lenovo Tab2
and has Virtual
Soft keys
like this Pic.
Use this code in onCreate method and after setContentView(). It helped me.
if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT )
{
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 // hide nav bar
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY );
}