How To Ask Permission Or Automatically Set The Phone's Full Screen On Settings - Android Studio
I am trying to set my activity to full screen using this code below: private void hideSystemUI() { View decorView = getWindow().getDecorView(); decorView.setSystemUiVisibil
Solution 1:
this problem happen with me for 2 different devices and this because of the front camera notch or screen cutout.
I used this code in oncreate() :
hideSystemUI();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
getWindow().getAttributes().layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; }
Or in the theme style xml file add this line :
<itemname="android:windowLayoutInDisplayCutoutMode">shortEdges</item>Solution 2:
In your manifest file put
android:theme="@style/Theme.Design.NoActionBar"
or
android:theme="@style/AppTheme"and in your activity call hideSystemUI(); before setting the content view
like this :
finalint flags = 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;
getWindow().getDecorView().setSystemUiVisibility(flags);
setContentView(R.layout.activity_main);
Post a Comment for "How To Ask Permission Or Automatically Set The Phone's Full Screen On Settings - Android Studio"