How do I remove the title bar in android studio?

2020-02-02 04:01发布

In my app there is this title bar at the top where the overflow menu would be, but I don't need settings and only have one screen. When I change the theme like described in many other questions I get the old 2.2 theme. I want to have the modern theme just without the bar at the top.

24条回答
太酷不给撩
2楼-- · 2020-02-02 04:39

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

in onCreate() works!

查看更多
祖国的老花朵
3楼-- · 2020-02-02 04:40

Go to Project -> app -> main -> res -> values -> styles.xml

Change this line if you want to delete it for every view

 `<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">`

to

 `<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">`

if you want to make it just for one view you can change it in youre manifest data. Go to Android -> manifests -> AndroidManifest.xml. do following:

  1. Search the View you want to get this type of change <activity android:name"...">
  2. Add android:theme=""@style/Theme.AppCompat.NoActionBar"
查看更多
Explosion°爆炸
4楼-- · 2020-02-02 04:41

The easiest way: Just double click on this button and choose "NoTitleBar" ;)

Click here to see where it is :)

查看更多
forever°为你锁心
5楼-- · 2020-02-02 04:43

In styles.xml file, change DarkActionBar to NoActionBar

    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>

查看更多
家丑人穷心不美
6楼-- · 2020-02-02 04:43

This was working for me on values/styles.xml add items:

       `<item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>`
查看更多
别忘想泡老子
7楼-- · 2020-02-02 04:44

In the manifest file change to this:

android:theme="@style/Theme.AppCompat.Light.NoActionBar" >
查看更多
登录 后发表回答