Titanium Community Questions & Answer Archive

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

Android TableViewRow selectedColor, selectedBackgroundColor, ... not working with touch, tap, click

Hello again!

I have problems defining a cell-selection style on android,
when clicking/tapping/touching on the table-row.

here is my small sample code:

// create window
var win = Titanium.UI.createWindow({  
    backgroundColor:'red'
});

// create section
var tableviewSection = Titanium.UI.createTableViewSection();

// create some rows
for (var i = 1; i < 4; i++) {
    var row = Ti.UI.createTableViewRow({
        backgroundColor: 'blue',
        selectedBackgroundColor: 'green', // not working with tap/touch

        color: 'yellow',
        selectedColor: 'white', // not working with tap/touch

        title: 'test ' + i,
        className: 'testrow'
    });

    tableviewSection.add(row);
}

// tableview
var tableview = Ti.UI.createTableView({
    data: [tableviewSection]
});
    win.add(tableview);

// open window
win.open();

The selectedColor/selectedBackgroundColor property won't affect on clicking, touching, tapping, etc. But if i use the hardware-navigation (trackball, arrow-direction-keys) the selection-style works.

the selection neither works on the android simulator nor on my android device (HTC Hero).

I'm using Titanium SDK 1.4.2 and the android sdk "APIs 2.1-update1".

hope you have some advices/tips for me :)

greetings,
robert

— asked November 26th 2010 by Robert Rockmann
  • 1.4.2
  • android
  • click
  • clicking
  • selectedbackgroundcolor
  • selectedcolor
  • selection
  • style
  • tableview
  • tableviewrow
  • tap
  • tapping
  • touch
0 Comments

2 Answers

  • Robert

    Clicking/tapping/touching is not selecting - you have to create eventListeners to change the colours accordingly. :)

    — answered November 26th 2010 by Paul Dowsett
    permalink
    0 Comments
  • meh.. :( didn't want to hear it ;)
    but ok, thank you hal, i'll do it with an event-handler.

    but this would be a great improvement for further Titanium SDK Releases!!
    the possibility of giving a visual feedback when touching is absolutely necessary..

    — answered November 26th 2010 by Robert Rockmann
    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.