Thursday 9 January 2014

Hide the Title Bar and Status Bar in Android



Hide the Title Bar and Status Bar in Android

1.Hide the Title Bar Using AndroidManifest.xml

If you want to hide the title bar for particular Activity 
use the below code in AndroidManifest.xml within the <activity> tag.

 android:theme="@android:style/Theme.Black.NoTitleBar"

Example:
     <activity
            android:name=" MainScreen"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar " >

 Hide the Title Bar and Status Bar Using XML code.

If you want to hide the Title Bar and Status Bar for particular activity, use the below code in AndroidManifest.xml within the <activity> tag.

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

Example:
     <activity
            android:name=MainScreen"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen " >

Hide the Title Bar and Status Bar for entire Application Using XML code.

 If you want to hide the Title Bar and Status Bar for entire application,just use the above code in <application> tag.

Example:

 for hiding title bar:
        <application
         android:icon="@drawable/icon"
         android:label="@string/app_name"
         android:theme="@android:style/Theme.Black.NoTitleBar" >

 for hiding title and status bar:
        <application
         android:icon="@drawable/icon"
         android:label="@string/app_name"
         android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
                Working in Java file using java code

Hide the Title Bar Using java code.

If you want to hide the title bar for particular activity, use this java code above the setContentView() method.

requestWindowFeature(Window.FEATURE_NO_TITLE);

No comments:

Post a Comment