How to Make an Activity Fullscreen

public class FullScreen extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

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

        setContentView(R.layout.main);
    }
}

9 Comments

#
szeldon - May 28, 2009 at 5:54 p.m.

Alternatively you can add

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

to AndroidManifest.xml under <activity>

#
DrLuiji - August 21, 2009 at 7:06 p.m.

Many thanks !

#
JohnMlkolkzzbwwewee - September 18, 2009 at 7:56 p.m.

http://gologle.com, <a href=gologle.com>goolgle</a>

#
John Hansen - October 8, 2009 at 9:02 a.m.

Isn't there an easy way that we non-technical folks could use..??? (I don't understand this)

#
Fit Flops - January 28, 2010 at 12:06 a.m.

I had much success. Thanks.

#
bpell - January 28, 2010 at 4:58 a.m.

I have pretty much this same code in a sub.. easy to re-use:

public void setFullScreen() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

#
Skechers Shape Ups - February 19, 2010 at 3:27 p.m.

Understood it completely. Thanks.

#
Rapidshare SE - February 26, 2010 at 8:38 a.m.

Thanks for sharing! So short and so clear!

#
shubham - March 9, 2010 at 12:46 p.m.

It's fine..and useful for learner also

Add a Comment