How to make activity as Full screen (Removing Title Bar or Action Bar)

If want to make an activity to full screen in some cases like playing video in full screen mode, playing game etc., you can do that by following one of the methods.

Method 1

One way is using Theme.Holo.Light.NoActionBar.Fullscreen value in AndroidManifest.xml file. (Use the appropriate theme name whichever you used in your application)

<activity android:name=".MainActivity"
Method 2

Another way is, do this through code in the activity. In your activity do the following before calling setContentView() function

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
Happy coding! 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s