How to make full screen in Android 4.0
Asked Answered
M

4

9

Android 4.0 phones only have virtual buttons, which actually go invisible when playing youtube/video at fullscreen (the video portion takes over where the buttons are).

I want to do this, but haven't found a way.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

or

requestWindowFeature(Window.FEATURE_NO_TITLE); 
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

do not cover the virtual buttons.

Here is an example that shows the type of full screen I'm talking about:

http://www.youtube.com/watch?v=Lw_O1JpmPns

Margit answered 30/12, 2011 at 15:44 Comment(0)
M
8

Okay, I added this SYSTEM_UI_FLAG_HIDE_NAVIGATION flag to my video activity and that hid the virtual buttons.

WebView view = new WebView(this);
view.setSystemUiVisibility(WebView.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

Another choice is to use the SYSTEM_UI_FLAG_LOW_PROFILE flag. This doesn't hide the buttons though. Instead it makes the buttons go to "Low Profile" mode (basically turns them into little dots)

Margit answered 31/12, 2011 at 3:43 Comment(0)
R
2

This works on my device but not in the emulator. Add this tho your activity in AndroidManifest.xml:

    <activity ...
        android:theme="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen" >
Rosemarierosemary answered 15/5, 2012 at 17:55 Comment(0)
M
2

Inside the onCreate() of your Activity, add this:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
     WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().getDecorView()
    .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);

Worked well for me (but is not Honeycomb-compatible).

Massy answered 30/5, 2013 at 23:59 Comment(0)
V
1

To make the buttons completely invisible, you should do

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
         WindowManager.LayoutParams.FLAG_FULLSCREEN);
this.getWindow().getDecorView()
        .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 
               | View.SYSTEM_UI_FLAG_IMMERSIVE);

The buttons would not use any space on the screen, unless you swipe up from the bottom of the screen. Notice that you need to target at SDK version 19 for this to work.

Vanpelt answered 3/4, 2014 at 19:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.