Search code examples
androidappceleratorappcelerator-titaniumappcelerator-alloy

Titanium - Hiding Android actionBar for specific window


I'm trying to hide the actionBar for a specific window. I've followed this: http://www.appcelerator.com/blog/2014/08/hiding-the-android-actionbar/ which used to work for me in the past.

What I did was to create a custom theme like this:

<?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>

I've set the following in my tiapp.xml:

<android xmlns:android="http://schemas.android.com/apk/res/android">
    <manifest>
        <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
    </manifest>
</android>

And I've set the following in my window tss:

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

but still the action bar shows. If I hide it from code on window open event than it cuts the background image I have - so I rather do it with a theme.

how can I hide action bar with theme on sdk 5.2.0?


Solution

  • I was able to solve the problem by changing my custom theme to this:

    <?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>