Subwindow - Android
My question is how to create a subwindow for android in windows.Android does not like the win1.add(subwin); command. It works for labels.
Please find me solution to solve the problem.
Thanks and Regards,
Venkatesan.R
2 Answers
-
Accepted Answer
venkatesan
The problem you have is that you cannot add a window to another window, but you can open one from a window.
Drop this code into your app.js, and hopefully you will see what I mean:
var win1 = Ti.UI.createWindow({ backgroundColor:'red', navBarHidden:false, title:'this is window 1' }); var view1 = Ti.UI.createView({ backgroundColor:'green' }); win1.add(view1); var button = Ti.UI.createButton({ title:'open win2' }); view1.add(button); button.addEventListener('click', function(){ var win2 = Ti.UI.createWindow({ backgroundColor:'blue', navBarHidden:false, title:'this is window 2' }); var view1 = Ti.UI.createView({ backgroundColor:'yellow' }); win2.open(); });
-
AFAIK, windows exist on their own, not as children of anything, particularly each other. You can create multiple windows and hide/show them as needed. But, you can't do as you were trying to do. If you don't need anything especially window-ish, could you use a view for your subwin?