in Android by
Android Hide Title Bar and Full Screen Example

► Click here to show 1 Answer

0 votes
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.

requestWindowFeature(Window.FEATURE_NO_TITLE);//will hide the title   

getSupportActionBar().hide(); //hide 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.


               WindowManager.LayoutParams.FLAG_FULLSCREEN); //show the activity in full screen  


Android Hide Title Bar and Full Screen Example

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


File: activity_main.xml

<?xml version="1.0" encoding="utf-8"?>  

< xmlns:android=""










        android:text="Hello World!"  




        app:layout_constraintTop_toTopOf="parent" />  



Activity class





import android.os.Bundle;  

import android.view.Window;  

import android.view.WindowManager;  


public class MainActivity extends AppCompatActivity {  



    protected void onCreate(Bundle savedInstanceState) {  


        requestWindowFeature(Window.FEATURE_NO_TITLE); //will hide the title   

        getSupportActionBar().hide(); // hide the title bar  


               WindowManager.LayoutParams.FLAG_FULLSCREEN); //enable full screen  





Learn More with Madanswer

Related questions

0 votes
asked Jan 14 in Android by RShastri