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"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Holo.Light.NoActionBar.Fullscreen">
</activity>
Method 2

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

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
setContentView(R.layout.activity_main);
Happy coding! 🙂
Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s