Titanium Community Questions & Answer Archive

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

text alignment of tableViewRows

Hi there,
I'm new to appcelerator.
I'm trying to create a simple vertical menu. Each menu item has a nice glossyback.png background to it with the title text displayed over the background. The issue that I have is that the text is left aligned by default and I cannot for the life of me figure out how to center the text in the column. Please could someone help me with this or perhaps suggest a better way to achieve the same thing?

Here is the code:

var data = [];
data[0] = Ti.UI.createTableViewRow(
{
  title:'Featured',
  backgroundImage:"/images/glossyback.png"
});
data[1] = Ti.UI.createTableViewRow(
{
  title:'Categories',
  backgroundImage:"/images/glossyback.png"
});
data[2] = Ti.UI.createTableViewRow(
{
  title:'Search',
  backgroundImage:"/images/glossyback.png"
});
data[3] = Ti.UI.createTableViewRow(
{
  title:'Download Zone',
  backgroundImage:"/images/glossyback.png"
});
var tableview = Titanium.UI.createTableView({
    data:data
});

TIA
D~

— asked July 26th 2010 by De Wet Steynberg
  • menu
  • tableviewrow
0 Comments

1 Answer

  • Accepted Answer

    You need to create a custom row for this.
    Create a label , align it centered and add it to the row.

    Here you have a small tutorial about custom rows

    http://cssgallery.info/custom-row-for-tableview-in-appcelerator-titanium/

    — answered July 26th 2010 by Dan Tamas
    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.