如何隐藏一个活动的XML与现有的自定义主题的标题栏自定义、标题栏、主题、XML

2023-09-11 23:54:45 作者:不离不弃纯属童言无忌

我要隐藏标题栏的我的一些活动。问题是,我申请一个风格,我所有的活动,所以我不能简单地设立了主题为@android:款式/ Theme.NoTitleBar。

I want to hide the titlebar for some of my activities. The problem is that I applied a style to all my activities, therefore I can't simply set the theme to @android:style/Theme.NoTitleBar.

使用NoTitleBar主题作为父母对我的风格,将去掉标题栏得多的活动。

Using the NoTitleBar theme as a parent for my style would remove the title bar for to much activities.

我可以在某处设置一个没有标题风格的项目?

Can I set a no title style item somewhere?

推荐答案

我现在做了以下。

我宣布一个风格继承了从我的大将风范,然后禁用标题栏。

I declared a style inheriting everything from my general style and then disabling the titleBar.

<style name="generalnotitle" parent="general">
    <item name="android:windowNoTitle">true</item>
</style>

现在我可以将这种风格到每一个活动中,我想隐藏标题栏重写应用广泛的风格和继承所有其他样式的信息,为此,在式的code无重复。

Now I can set this style to every Activity in which I want to hide the title bar overwriting the application wide style and inheriting all the other style informations, therefor no duplication in the style code.