I'm making a fullscreen Android app. Inside it I have a WebView that loads a web page that has a text input on it. When user clicks on the text input the app exits the fullscreen mode and never returns back.
I can use a js-android interface to call a function that forces it to go back fullscreen every time the input loses the focus or make a fake on-screen keyboard but I'm looking for a better solution.
This is how I force it to go into a fullscreen mode in the first place:
public static void setStickFullScreen(View view) {
int systemUiVisibility = view.getSystemUiVisibility();
int flags = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
systemUiVisibility |= flags;
view.setSystemUiVisibility(systemUiVisibility);
}
@Override public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
setStickFullScreen(getWindow().getDecorView());
}
I want it to be always fullscreen without showing top and bottom android navigation.
Is there any way to do so?
The solution was in another place.
The theme of the app should've been inherited from the NoActionBar theme:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
</style>