Android make activity as Fullscreen (Removing Title Bar or Action Bar)

If want to make an activity to fullscreen in some cases like playing video in fullscreen 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 1



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);