Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27626

Android: TableView allowsSelection(true) property does not keep the row highlighted

    Details

      Description

      First reported as a regression in SDK 6.1.0. Regression still exists in latest SDK build. Note that this issue only affects Android. It works as intended on iOS.

      When using TableView with allowsSelection set to true and rows containing labels with highlightedColor property, the row does not stay highlighted upon selection.

      Test Code:

      var createRow = function (title) {
      		var row = Ti.UI.createTableViewRow({
      			accessibilityLabel: title,
      			className: 'test',
      			height: 80,
      			selectedBackgroundColor: '#ff0000'
      		});
       
      		var titleLabel = Ti.UI.createLabel({
      			accessibilityLabel: title,
      			font: {
      				fontFamily: 'Helvetica-Bold',
      				fontSize: 20
      			},
      			height: 24,
      			highlightedColor: '#fff',
      			left: 10,
      			text: title,
      			touchEnabled: false
      		});
       
      		row.add(titleLabel);
       
      		return row;
      	};
       
      	var tableData = [];
       
      	for (var i = 0, l = 100; i < l; i++) {
      		var row = createRow('Row Index # ' + i);
      		tableData.push(row);
      	}
       
      	var tableView = Ti.UI.createTableView({
      		accessibilityLabel: 'TableView_35',
      		allowsSelection: true,
      		data: tableData,
      		rowHeight: 80,
      		top: 0
      	});
       
      	win.add(tableView);
      	win.open();
      

      Test steps

      • Create new classic app
      • Copy the code above into app.js
      • Run the app
      • Click on a random row
      • Row will flash red

      Expected result
      Row should stay highlighted and should only become de-highlighted when another row is selected.

      Note (unexpected result)
      If you long-press a row, you will notice that the text label color stays the same, irregardless of the highlightedColor property.

        Attachments

          Activity

            People

            • Assignee:
              ybanev Yordan Banev
              Reporter:
              ssaddique Sohail Saddique
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration