Home » Android Hide Title Bar Example

Android Hide Title Bar Example

by Online Tutorials Library

Android Hide Title Bar and Full Screen Example

In this example, we are going to explain how to hide the title bar and how to display content in full screen mode.

The requestWindowFeature(Window.FEATURE_NO_TITLE) method of Activity must be called to hide the title. But, it must be coded before the setContentView method.

Code that hides title bar of activity

The getSupportActionBar() method is used to retrieve the instance of ActionBar class. Calling the hide() method of ActionBar class hides the title bar.

Code that enables full screen mode of activity

The setFlags() method of Window class is used to display content in full screen mode. You need to pass the WindowManager.LayoutParams.FLAG_FULLSCREEN constant in the setFlags method.

Android Hide Title Bar and Full Screen Example

Let’s see the full code to hide the title bar in android.

activity_main.xml

File: activity_main.xml

Activity class

File: MainActivity.java

Output: Hiding the Title Only

android hide title bar example output 1

Output: Hiding the TitleBar and enabling FullScreen

android hide title bar example output 2

You may also like