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({  

// 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'


// tableview
var tableview = Ti.UI.createTableView({
    data: [tableviewSection]

// open window

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 :)


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

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
  • 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
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.