在Android的禁止行动起来吧来吧、行动、Android

2023-09-12 02:24:32 作者:待绝笔墨痕干

我用 requestWindowFeature(Window.FEATURE_NO_TITLE_BAR); 为禁用的标题栏。 我只是想知道是否有反正有上面使用code后,使标题栏?

I used requestWindowFeature(Window.FEATURE_NO_TITLE_BAR); for disable the title bar. I just wondering is there has anyway to enable the Title Bar after use above code?

推荐答案

您可以把您希望通过定义属性 Android的任何活动的操作栏和显示/隐藏的可见性控制:windowActionBar styles.xml 并相应地使用它在Android清单文件。

You can take control of the visibility of the action bar and show/hide in any activity you want by defining the attribute android:windowActionBar in styles.xml and use it accordingly in the Android Manifest file.

例如,在 styles.xml

<style name="NoActionBar" parent="AppBaseTheme">
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
</style>

现在在你的Andr​​oid清单文件,

And now in your Android Manifest file,

<activity
            android:name="com.package.name.ActivityName"
            android:label="@string/app_name"
            android:theme="@style/NoActionBar" >
 </activity>

您可以致电机器人:主题=@风格/ NoActionBar来任何您不希望被显示的操作栏活性

You can call android:theme="@style/NoActionBar" to any activity that you don't want the action bar to be displayed.