Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16493] Android: Let `transparent` or alpha channel trigger transparent background on heavyweight windows

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionCannot Reproduce
Resolution Date2015-04-29T02:30:47.000+0000
Affected Version/sRelease 3.2.1
Fix Version/sRelease 4.1.0
ComponentsAndroid
Labelsheavyweight, opacity, transparency, window
ReporterFokke Zandbergen
AssigneeAshraf Abu
Created2014-02-23T20:06:01.000+0000
Updated2015-04-29T02:31:16.000+0000

Description

To have a transparent or non-opaque (heavyweight) window on Android, you have to set opacity to any value, including 1.0. As you can see on [line 268 of the WindowProxy](https://github.com/appcelerator/titanium_mobile/blob/c7c578c6ce8286195be7019c2165d4de62b202c7/android/modules/ui/src/java/ti/modules/titanium/ui/WindowProxy.java#L268) this triggers the actual Window to have a transparent background (triggering the Translucent theme. The you can use backgroundColor:transparent or backgroundColor:#5FFF even if you leave opacity:1.0 because you want to leave the actual contents the window opaque. As #TIMOB-16353 shows this is highly confusing, even for Appcelerator support ;) I would ask for backgroundColor::transparent and colors including an alpha-channel like #5FFF to trigger the transparent background as well.

Doesn't work

Ti.UI.createWindow({
  backgroundColor: 'transparent'
});

Works

Ti.UI.createWindow({
  backgroundColor: 'transparent',
  opacity: 1.0
});

Comments

  1. Ritu Agrawal 2014-02-24

    Moving this improvement request to engineering for further evaluation and prioritization.
  2. Ingo Muschenetz 2014-08-14

    3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.
  3. Ashraf Abu 2014-12-29

    Tried this with Titanium SDK version 3.5.0.v20141217170926 and had no problems trying to do this. Code as follows:-
       var win = Ti.UI.createWindow({
       backgroundColor : '#500f'
       });
       
       var b1 = Ti.UI.createButton({ 
       title : 'Open Window', 
       height : 'auto', 
       width : 'auto' 
       });
       
       b1.addEventListener('click', function(e) {
       	var w = Ti.UI.createWindow({ 
       	backgroundColor : 'transparent',
       	});
       	
       	var l = Ti.UI.createLabel({ 
       	backgroundColor : 'white', 
       	color : 'black', 
       	width : Ti.UI.Size, 
       	height : Ti.UI.Size, 
       	text : 'Can you see the back?' 
       	});
       	w.add(l);
       	
       	w.open({ 
       	animated : true
       	});
       });
       
       win.add(b1);
       win.open();
       
  4. Ashraf Abu 2015-04-29

    With the sample code above, it seems to work. I do not see any issues. Hence closing this as Cannot Produce.

JSON Source