How do I remove the title bar in android studio?

后端 未结 24 1181
轮回少年
轮回少年 2020-12-04 08:03

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

相关标签:
24条回答
  • 2020-12-04 08:44
    1. open styles.xml
    2. insert
     <style name="no_title" parent="AppTheme">
            <item name="android:windowNoTitle">true</item>
            <item name="android:windowContentOverlay">@null</item>
     </style>
    

    you can change name="---------"

    1. open Androidmaifest.xm

      find android:theme="@style/AppTheme" chang to android:theme="@style/no_title"

    2. click select Theme on menubar (it's green color near MainActivity)

      • click project Theme
      • click no_title (on you right hand Side)
      • click OK
    0 讨论(0)
  • 2020-12-04 08:46

    To simply remove the title bar (which means the bar contains your app name) from an activity, I simply add below line to that activity in the manifests\AndroidManifest.xml:

    android:theme="@style/AppTheme.NoActionBar"
    

    It should now look like below

    <activity
      android:name=".MyActivity"
      android:theme="@style/AppTheme.NoActionBar"></activity>
    

    Hope it'll be useful.

    0 讨论(0)
  • 2020-12-04 08:48

    Check this

     ActionBar actionBar = getSupportActionBar();
        actionBar.hide();
    
    0 讨论(0)
  • 2020-12-04 08:48

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);

    in onCreate() works!

    0 讨论(0)
  • 2020-12-04 08:49

    For Beginner Like Me. Just Do it what I say.From your Android Project.

    app -> res -> values -> style.xml

    replace this code

    <resources>
    
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>
    
    </resources>
    

    Enjoy.

    0 讨论(0)
  • 2020-12-04 08:50

    In AndroidManifest.xml of your application you'll find the android:theme for example set to @style/AppTheme

    Now go to styles.xml, find the style tag, make sure that name is set to AppTheme the same as in manifest and set parent to android:Theme.Holo.Light.NoActionBar (also do this in styles(v21) if you have it in your project)

    <style name="AppTheme" parent="android:Theme.Holo.Light.NoActionBar">
        <!-- ... -->
    </style>
    
    0 讨论(0)
提交回复
热议问题