Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14311] Android: View: opacity does not work when backgroundColor is changed

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-07-11T21:52:00.000+0000
Affected Version/sRelease 3.1.1, Release 3.2.0
Fix Version/s2013 Sprint 14, 2013 Sprint 14 API, Release 3.2.0
ComponentsAndroid
Labelsmodule_views, qe-testadded
ReporterPing Wang
AssigneePing Wang
Created2013-06-20T17:49:12.000+0000
Updated2013-10-11T12:18:53.000+0000

Description

var win = Ti.UI.createWindow({
	fullscreen: false
});

var label = Ti.UI.createLabel({
	bottom: 20,
	color: 'white',
	text: "A label in the window"
});
win.add(label);

var v = Ti.UI.createView({
	bottom: 10,
	height: 100,
	width: 100,
	opacity: 0.5,
	backgroundColor: 'blue'
});

var b = Ti.UI.createButton({
	top: 10,
	title: "change view backgroundColor"
});

b.addEventListener("click", function(){
	v.backgroundColor = "yellow";
});

var b1 = Ti.UI.createButton({
	top: 110,
	title: "remove view"
});

b1.addEventListener("click", function(){
	win.remove(v);
});

var b2 = Ti.UI.createButton({
	top: 210,
	title: "add view"
});

b2.addEventListener("click", function(){
	win.add(v);
});

win.add(b);
win.add(b1);
win.add(b2);
win.add(v);
win.open();
Steps to reproduce: 1. Run the above code. Should see a translucent blue view on the screen. 2. Click the button "change view backgroundColor". Actual behavior: The view becomes opaque yellow. Expected behavior: The view becomes translucent yellow. Note: if click the button "remove view" and then "add view", we can see the view becomes translucent yellow.

Comments

  1. Ping Wang 2013-06-26

    PR: https://github.com/appcelerator/titanium_mobile/pull/4418
  2. Ping Wang 2013-06-27

    This bug only happens on 2.3 devices. For FR, please run the test case on 2.3, 3.x and 4.x devices.
  3. Paras Mishra 2013-10-11

    Opacity is working fine when backgorundColor is changed. Verified fix on: Device : Google Nexus 7, Android Version: 4.3 Device: Samsung Galaxy Note, Android version: 2.3.6 SDK: 3.2.0.v20131010163242 CLI version : 3.2.0 OS : MAC OSX 10.8.4 Alloy : 1.2.2 Appcelerator Studio, build: 3.2.0.201310092427 XCode : 5

JSON Source