Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Horizontal alignment of text fields

Greetings,

I'm pretty new to Appcelerator, so please bear with me.

I'm trying to place a simple text field in the window:

var uname = Titanium.UI.createTextField({
    color:'#336699',
    height:35,
    top:10,
    left:10,
    width:250,
    borderStyle:Titanium.UI.INPUT_BORDERSTYLE_ROUNDED
});
win1.add(uname);

But it's appearing aligned left. Is there any quick way to make it show up in the centre of the page?

Many thanks,

— asked November 8th 2010 by Eamonn Hynes
  • align
  • field
  • text
  • textfield
0 Comments

3 Answers

  • Hi Eamonn

    Yes, remove the "left" property

    Hal

    — answered November 8th 2010 by Paul Dowsett
    permalink
    4 Comments
    • That's fixed it. I'm sure I'll be up to speed once I get the hang of things. I'm supposed to be the "expert" here and I've nobody to ask these kinds of questions. Many thanks,

      — commented November 8th 2010 by Eamonn Hynes
    • You're welcome Eamonn

      Would you mind marking this answer as the correct one, to close it?

      Cheers

      Hal

      — commented November 8th 2010 by Paul Dowsett
    • @Eamonn take some basic lessons on CSS , you will find it very helpful while designing UI in Ti.(it sure helped). :)

      — commented November 9th 2010 by Satta Ravi
    • Sattanaathan,

      Expecting Ti layouts to work like CSS I fear would only lead to confusion. When JSS is introduced, maybe your statement will be more pertinent.

      — commented November 9th 2010 by Paul Dowsett
  • Eamonn

    Please mark the answer above as the best answer, if it resolved your problem

    Thank you

    — answered November 9th 2010 by Paul Dowsett
    permalink
    0 Comments
  • ping Eamonn - please see my other comment

    — answered November 9th 2010 by Paul Dowsett
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.