I have made var createtabgroup. But i want to make with adding button and label in top of tabgroup. And so, i make var createwindow. When i add tabgruop in window, it can not running in application. What make it wrong? Any better solution? Thank you. Hope get your best solution.
I use android 2.2 and Win 7 x32
7 Answers
You don't add tabgroups to a window, you add windows to a tabgroup. I'd suggest skimming the TabGroup Docs once and then possibly creating a default project to see an example of how the TabGroup works.
TabGroup is the most Parent Element.and window is its child.So,I dnt think,it is possible to add native tabgroup to a window.if u want the same,i think you can make your own customized tab group and then you can add that on window.
I have not been able to answer to my problem. For the simple, what i should do, if i want to show button "home" and "next" on the top of many tab within there is window in each tab? Big hope to help me well. :(
For each window that you attach to a tab, you can use the leftNavButton and rightNavButton to add buttons to the title bar for each. Assuming win1 below is attached to tab1 it would look something like this:
var homebtn = Ti.UI.createButton({ title:'Home' }); homebtn.addEventListener('click', function() { alert('You clicked the home button.') }); win1.leftNavButton = homebtn; var nextbtn = Ti.UI.createButton({ title:'Next' }); nextbtn.addEventListener('click', function() { alert('You clicked the next button.') }); win1.rightNavButton = nextbtn;Please keep in mind, that if you open a new window within a tabgroup like this:
tabGroup.currentTab.open(newWindow);Then newWindow will automatically get a 'back' button as the left nav button, so you wouldn't want to override that functionality.
I'm posting this as a completely different answer as to not confuse it with the conversation in the previous thread. Try this Navigation Controller, I think it might do everything that you are looking for. Import the entire test app from: https://github.com/xsaero00/Ti-Navigation-Controller
Anthony, i have run your code. But, it's not about tabgroup. Ok, i want to make application like this url http://imageshack.us/photo/my-images/255/unnamedi.jpg/ . This picture is foursquare. So, foursquare has 3 tab. And on the top of tabs, there is a button. So, how can it be added on the top?? Could give me a code? For my code, i make like this
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#800000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
var win1 = Titanium.UI.createWindow({ title:'Original', url:'tab/original.js' });
var tab1 = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Original', window:win1 });
var win2 = Titanium.UI.createWindow({ title:'Paket', url:'tab/paket.js' });
var tab2 = Titanium.UI.createTab({ icon:'KS_nav_ui.png', title:'Praktis', window:win2 });
// add tabs
tabGroup.addTab(tab1); tabGroup.addTab(tab2);
// open tab group
tabGroup.open();
Ok, see, your code and the image should have been posted in the original question, we wouldn't be this deep if you would have posted them in the beginning, and we definitely would have had an answer by now. For your current code, you should think about switching to commonjs if you're going to be using a common element (like the one Im about to give you below) on all your windows. You can see how commonjs apps are structured by creating a new app using the tabbed application template.
I'm not going to write the code for you, but I'll give you the basic idea with some pseudo-code that you can use.
// Create a header view container that will encapsulate everything in the header // This should fill the entire width of the device, and be only as high as the elements you put in it var headerView = Ti.UI.createView(); // Create the image view for your logo. Position this all the way to the left and add it to the view var logo = Ti.UI.createImageView(); headerView.add(logo); // Create your home button, use an image as the bg. Position this all the way to the right and add it to the view. var homeBtn = Ti.UI.createButton(); headerView.add(homeBtn); // Do the same thing with the back btn. Position it next to the home btn and add it to the view. var backBtn = Ti.UI.createButton(); headerView.add(backBtn); // Add any extras that you need, event listeners, actions, etc. then return the headerView and add it to the window.Now if you wrap all that in a commonjs module and then add it to every window that you need the bar on.
Your Answer
Think you can help? Login to answer this question!