Wednesday, June 26, 2013

Hide Title Bar In Android

In android we can hide the Title Bar. As you have seen there is not Title Bar in many game apps like Temple Run, Subway Surf etc.

Here is the code you need to write in your Activity.

public class MainActivity extends Activity
{

            @Override
            protected void onCreate(Bundle savedInstanceState)
            {
                     super.onCreate(savedInstanceState);
                   
                     requestWindowFeature(Window.FEATURE_NO_TITLE);
                     this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                     WindowManager.LayoutParams.FLAG_FULLSCREEN);

                     setContentView(R.layout.activity_main);
       
            }
}


See the snapshot, there is not title bar.


4 comments: