Change Window background image on change of orientation
I consult the sample on kitchensink but I need to know how to change the window background image on the fly.
I tried the following but it doesn't work
window.onload = function()
{
Titanium.Gesture.addEventListener('orientationchange',function(e)
{
var o = '';
if (Titanium.Gesture.isLandscape(e.to))
{
Titanium.UI.currentWindows.backgroundImage = "bg_day_landscape.png";
}
else if (Titanium.Gesture.isPortrait(e.to))
{
o = 'I am portrait';
}
});
3 Answers
-
Instead of changing the background, why not have a view or just an ImageView that gets changed? Then you could animate the image change if you needed/wanted to.
-
Can also try changing "currentWindows" to "currentWindow".
-
Still doesn't work even I changed "currentWindows" to "currentWindow".
Clint, would you describe how to do what you suggest in greater detail?
I can't figure out what you mean.
Thanks!