Changing the Window theme dynamically #13744
-
Hello. I created two files for my dark and light theme My XML code (index.xml): <Alloy>
<Window id="win" theme='Theme.MyLightTheme'>
<Button onClick="setDark">Set Dark</Button>
</Window>
</Alloy> My controller (index.js): $.win.open()
function setDark() {
$.win.applyProperties({theme: 'Theme.MyDarkTheme'})
} But dynamically it is not possible to change the theme. How can i do this? I tried searching for a similar question but couldn't find it. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You have to reopen the window. Check the docs: https://titaniumsdk.com/api/titanium/ui/window.html#properties_theme it says "creation only". Those properties only work one time when the window is created. That said: you can switch between the system dark/light mode. Check the |
Beta Was this translation helpful? Give feedback.
You have to reopen the window. Check the docs: https://titaniumsdk.com/api/titanium/ui/window.html#properties_theme it says "creation only". Those properties only work one time when the window is created.
That said: you can switch between the system dark/light mode. Check the
extended app sample
in this comment (you have to toggle it). That way you would need to create a standard Android dark theme (same theme name in avalues-dark
folder)