Titanium - 隐藏特定窗口的Android actionBar

时间:2016-02-26 19:31:04

标签: android appcelerator appcelerator-titanium appcelerator-alloy

我正在尝试隐藏特定窗口的actionBar。我跟着这个:http://www.appcelerator.com/blog/2014/08/hiding-the-android-actionbar/过去常常为我工作。

我所做的是创建这样的自定义主题:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.NoActionBar" parent="@style/Theme.AppCompat">
        <item name="android:windowNoTitle">true</item>
    </style>
    <style name="Theme.YesActionBar" parent="@style/Theme.AppCompat">
        <item name="android:windowNoTitle">false</item>
    </style>
</resources>

我在tiapp.xml

中设置了以下内容
<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
    </manifest>
</android>

我在我的窗口tss中设置了以下内容:

"Window[platform=android]" : {
    theme: 'Theme.NoActionBar'
}

但仍然显示操作栏。如果我将它隐藏在窗口打开事件的代码中,而不是剪切我拥有的背景图像 - 所以我宁愿用主题来做它。

如何在sdk 5.2.0上隐藏带主题的操作栏?

1 个答案:

答案 0 :(得分:1)

我能够通过将自定义主题更改为此来解决问题:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.NoActionBar" parent="@style/Theme.AppCompat">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
    <style name="Theme.YesActionBar" parent="@style/Theme.AppCompat">
        <item name="windowActionBar">true</item>
        <item name="windowNoTitle">false</item>
    </style>
</resources>