Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4648] Android: TableViewRow opacity ignored when a backgroundSelectedColor is also set

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2012-01-04T15:25:16.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sSprint 2011-29, Release 1.8.0, Release 1.7.6
ComponentsAndroid
Labelsmodule_tableviewrow, qe-testadded
ReporterBill Dawson
AssigneeVikramjeet Singh
Created2011-07-13T09:06:40.000+0000
Updated2012-01-04T15:25:16.000+0000

Description

Using this test app:
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({  
    title:'Test',
    backgroundColor:'green',
	exitOnClose: true
});

var cb, btn;
var tv = null;
win.add(cb = Ti.UI.createSwitch({
	value: true,
	style: Ti.UI.Android.SWITCH_STYLE_CHECKBOX,
	title: "Give one row backgroundSelectedColor",
	top: "5dp", left: "5dp", right: "5dp", height: "60dp"
}));
win.add(btn = Ti.UI.createButton({
	title: "Create TableView",
	top: "65dp", left: "5dp", width: "200dp", height: "40dp"
}));
btn.addEventListener('click', function(e) {
	if (tv !== null) {
		win.remove(tv);
	}
	win.add(tv = Ti.UI.createTableView({
		top: "110dp", left: "0dp", right: "0dp", bottom: "0dp",
		backgroundColor: "blue", opacity: 0.8
	}));


	var rows = [];
	for (var i = 0; i < 10; i++) {
		var row = Ti.UI.createTableViewRow();
		row.title = "Row " + (i + 1);
		if (i === 4) {
			row.title = "Evil row";
			row.backgroundColor =  "yellow";
			if (cb.value) {
				row.backgroundSelectedColor = "red";
			}
		}
		if (i === 5) {
			row.title = "With opacity";
			row.backgroundColor =  "yellow";
			row.opacity=0.8;
			if (cb.value) {
				row.backgroundSelectedColor = "red";
			}
		}
		if (i === 8) {
			// Just testing standard background
			row.backgroundColor = "yellow";
			row.title = "I am yellow";
		}
		rows.push(row);
	}
	tv.setData(rows);
});


win.open();
If you UNcheck the top checkbox and create the tableview, you'll see that "Evil Row" and "With Opacity" row look different because the "With Opacity" row has an opacity of 0.8 set on it. If you then check the top checkbox and do it again, the two rows will look the same, when they should NOT look the same (since one of them has 0.8 opacity set.)

Comments

  1. Vikramjeet Singh 2011-09-13

    Resolved. Tested On: Mac OSX Lion TiMob: 1.8.0.v20110906155354 TiStud: 1.0.5.201109091616 Devices Used: Android Emulator 2.2 Droid1 Droid3
  2. Opie Cyrus 2011-12-08

    updating fixed version for merge
  3. Michael Pettiford 2011-12-09

    Tested on Ti Studio 1.0.7.201112080131 
Ti Mob SDK 1.8.0.1.v20111209011840 
OSX Lion Nexus S OS 2.3.6 Expected behavior is shown of the opacity being correctly set
  4. Michael Pettiford 2012-01-04

    Reopening/closing to add/remove labels

JSON Source