0

There are some questions about Fullscreen but in my case, I'm using one java class with (AbsRuntimePermission extends AppCompatActivity) and the (MainActivity extends AbsRuntimePermission)

My problem is: the Fullscreen mode is working just in the Samsung phone.

By the way, the Home button is my problem, the title is already hidden.

In my MainActivity I'm using this windows code:

   @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    requestAppPermissions(new String[]{android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.WRITE_EXTERNAL_STORAGE,
            android.Manifest.permission.INTERNET, Manifest.permission.READ_EXTERNAL_STORAGE}, R.string.msg, REQUEST_PERMISSION);

In my Styles I'm using the .AppCompat.NoActionBar.

  <style name="PlayerTheme" parent="Theme.AppCompat.NoActionBar">

Following another questions about Fullscreen, I tryed to use this code in my styles

 <style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
 <item name="windowNoTitle">true</item>
 <item name="windowActionBar">false</item>
 <item name="android:windowFullscreen">true</item>
 <item name="android:windowContentOverlay">@null</item>
 </style>

and then change the manifest for theme .AppCompat.Light.NoActionBar.FullScreen But it is not working. Are there any permission that I need to use when I have RuntimePermission?

Mel
  • 5,837
  • 10
  • 37
  • 42

1 Answers1

0

solved: i have check this code it works on android version 4.0.4 api(15) and some above versions

  1. after content view ADD this this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

chnage your style into

<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
  1. if your using api level 19 or above than use Immersive Full-Screen Mode override this function it will works fine

ex:

     @Override
     public  void onWindowFocusChanged(boolean  hasFocus){
     super.onWindowFocusChanged(hasFocus);
     View decorView = getWindow().getDecorView();
    if(hasFocus){

    decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                |View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY 
                |View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN  
                |View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION  
                |View.SYSTEM_UI_FLAG_FULLSCREEN  // hide status bar
                |View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
    }
}

hope answered the question if its useful than vote up

Abubakar
  • 374
  • 3
  • 16