顶级应用栏不会在Lollipop - API 21中消失

时间:2016-02-04 07:01:49

标签: android

我在values-v21中编写了样式,还包括主题 在清单中:

<activity
    android:name=".events"
    android:label="@string/title_activity_events"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme.NoActionBar" />

在values-v21的styles.xml中,我写的是:

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

尽管它在API&lt; = 19

中消失,但API-21中的顶部操作栏仍未消失

有人可以告诉愚蠢的地方。

2 个答案:

答案 0 :(得分:1)

您可以以编程方式执行此操作:

getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getSupportActionBar().hide();

答案 1 :(得分:1)

您必须将父级设置为Theme.AppCompat

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat">
        <item name="colorPrimary">@android:color/white</item>
        <!-- Customize your theme here. -->
    </style>

</resources>

希望这有帮助。

相关问题