How to remove title bar in android?
Solution 1
In the Style.xml window (App->src->main->res->values->styles.xml
)
make changes to the <resources>
to look like this:
<resources>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
</style>
</resources>
Solution 2
This won't work on Android Studio. You need to edit your AndroidManifest.xml and add this line to the Activity in which you want the window title to be removed:
<activity
...
android:theme="@style/Theme.AppCompat.NoActionBar"
...
>
If you require the title to be removed on all activities I suggest to pick a title-less App Theme.
Solution 3
try to change
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
into
this.supportrequestWindowFeature(Window.FEATURE_NO_TITLE);
works for me
Solution 4
Several clean and easy ways to remove the title bar in android application. I have tested them in Android Studio 2.1.1
if MainActivity extends AppCompatActivity in the MainActivity.java,
a. you can add two attributes in the activity tag in the AndroidManifest.xml,
<activity android:label="@string/app_name" android:theme="@android:style/Theme.AppCompat.NoActionBar"> ... </activity>
b. or you can add a method in the onCreate() of the MainActivity.java file, before setContentView(R.layout.activity_main);
getSupportActionBar().hide();
if MainActivity extends Activity in the MainActivity.java,
a. you can add two attributes in the activity tag in the AndroidManifest.xml,
<activity android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> ... </activity>
b. or you can add a method in the onCreate() of the MainActivity.java file, before super.onCreate() and setContentView(R.layout.activity_main);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Solution 5
Please mind that you should call this.requestWindowFeature(Window.FEATURE_NO_TITLE)
before calling this.setContentView(R.layout.layout_name)
.
ChrisHarry
Updated on December 09, 2020Comments
-
ChrisHarry over 3 years
I want to do android program that contains no title bar. For some reason I cant remove title bar. I have already tried this coding.
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
This one also I have tried but the program suddenly stops..
android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
How can I fix this?
-
ChrisHarry over 9 yearsalready done that...but I have already solve it..lol...just change the theme in style.xml to no action bar btw thank you..