[TIMOB-16493] Android: Let `transparent` or alpha channel trigger transparent background on heavyweight windows
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | High |
| Status | Closed |
| Resolution | Cannot Reproduce |
| Resolution Date | 2015-04-29T02:30:47.000+0000 |
| Affected Version/s | Release 3.2.1 |
| Fix Version/s | Release 4.1.0 |
| Components | Android |
| Labels | heavyweight, opacity, transparency, window |
| Reporter | Fokke Zandbergen |
| Assignee | Ashraf Abu |
| Created | 2014-02-23T20:06:01.000+0000 |
| Updated | 2015-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
});
Moving this improvement request to engineering for further evaluation and prioritization.
3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.
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();With the sample code above, it seems to work. I do not see any issues. Hence closing this as Cannot Produce.