No Title Bar Android Theme

前端 未结 7 2067
孤街浪徒
孤街浪徒 2020-12-30 04:18

In my application I want to use the Theme.NoTitleBar, but on the other hand I also don\'t want to loose the internal Theme of the Android OS.. I searched on the net and Foun

相关标签:
7条回答
  • In your styles.xml, modify style "AppTheme" like

        <!-- Application theme. -->
        <style name="AppTheme" parent="AppBaseTheme">
            <item name="android:windowActionBar">false</item>
            <item name="android:windowNoTitle">true</item> 
        </style>
    
    0 讨论(0)
  • 2020-12-30 04:57

    use android:theme="@android:style/Theme.NoTitleBar in manifest file's application tag to remove the title bar for whole application or put it in activity tag to remove the title bar from a single activity screen.

    0 讨论(0)
  • 2020-12-30 05:06
     this.requestWindowFeature(getWindow().FEATURE_NO_TITLE);
    
    0 讨论(0)
  • 2020-12-30 05:09

    In your manifest use:-

        android:theme="@style/AppTheme" >
    

    in styles.xml:-

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
           <item name="android:windowActionBar">false</item>
       <item name="android:windowNoTitle">true</item>
    </style>
    

    Surprisingly this works as yo desire, Using the same parent of AppBaseTheme in AppTheme does not.

    0 讨论(0)
  • 2020-12-30 05:10

    if you want the original style of your Ui to remain and the title bar to be removed with no effect on that, you have to remove the title bar in your activity rather than the manifest. leave the original theme style that you had in the manifest and in each activity that you want no title bar use this.requestWindowFeature(Window.FEATURE_NO_TITLE); in the oncreate() method before setcontentview() like this:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_signup);
        ...
    }
    
    0 讨论(0)
  • 2020-12-30 05:10

    Why are you changing android os inbuilt theme.

    As per your activity Require You have to implements this way

    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    

    as per @arianoo says you have to used this feature.

    I think this is better way to hide titlebar theme.

    0 讨论(0)
提交回复
热议问题