Search code examples
androidtitaniumtitanium-mobile

how to implement layout of hbox/vbox in titanium


I am new to Titanium. Trying to design a 'Contact US' tab for Android app using Titanium Classic.

Initialized a View for the tab. Have filled the 1st half of screen space with Google Map, works fine.

After that i want to put -

Contact 24x7 - PhoneNumber [Call Button].

Email - email_id@mycompany.com [Email Button]

Now, i have set the layout of main view as Vertical, so that Maps and other items align vertically, which is what i want, but phone number and call button should be on the same line.

Implementing using top, left is not what i want as screen sizes vary a lot. Is there a way to implement a HBOX so that i can add label and the button in the HBox and then add them to the view.

Alternate question: How can i make the Phone number and Email ID as clickable text? so that on clicking them i can launch the dialpad or open the email app.

Thanks in Advance.

Regards, Saurav


Solution

  • To create an HBOX you should be able to do the same as how you have created your VBOX. i.e. Create a new view with layout="horizontal" and add the label and button to this. This new view can be added to your original vertical view so that it flows as you expect.

    As for your alternate question this is also possible. If you look at the autoLink property of Labels and TextAreas you will see the various options:

    http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.UI.Label

    Hope that helps