appceleratorappcelerator-titaniumappcelerator-mobileappcelerator-alloyappcelerator-studio

var win = Ti.UI.createWindow({theme: "Theme.MyThemeActionbar",}); not working in local file but working fine in tiapp.xml


I have set up the styles in platform/android/res/values/mycustomtheme.xml where I am trying to access the style property set in the XML from js file using the below line but it is not working.

var win = Ti.UI.createWindow({theme: "MyThemeActionbar"});

Solution

  • It depends on how you call you theme inside that XML file. E.g. my theme XML starts like this:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    
        <style name="Theme.MyThemeActionbar" parent="Theme.AppCompat">
        ...
    

    and I use the following TSS:

    "Window" : {
        theme: "Theme.MyThemeActionbar"
    }