GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-03-07T19:46:55.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | 2014 Sprint 05, 2014 Sprint 05 API, Release 3.3.0 |
Components | Android |
Labels | Alloy, Titanium, black, module_window, qe-closed-3.3.0, qe-testadded, transparent, triage, window |
Reporter | Henry David Spells III |
Assignee | Sunila |
Created | 2014-01-16T22:55:23.000+0000 |
Updated | 2014-07-26T06:00:24.000+0000 |
Here is the XML used to generate a transparent window. I don't think that the content matters as long as the content is smaller than the window so that you can see through to the window underneath. Basically I'm creating a transparent window with a list view in it to simulate a popup menu control.
Instead of seeing the window behind the list view, there is a black background on Android (iOS works fine).
<Alloy>
<Window id="PopupControl" class="container" onOpen="doOnOpen" onClick="doClose" androidback="doClose" onClose="doOnClose" backgroundColor='transparent'>
<ListView id="listView" defaultItemTemplate="template">
<Templates>
<ItemTemplate id="template" name="template">
<Label bindId="iconBottom" id="iconBottomId" />
<Label bindId="iconTop" id="iconTopId" />
<Label bindId="option" id="optionId" />
</ItemTemplate>
</Templates>
<ListSection id="optionsSection">
</ListSection>
</ListView>
</Window>
</Alloy>
I think that this is a bug in Titanium. The generated code seems to look right.
$.__views.PopupControl = Ti.UI.createWindow({
backgroundColor: "transparent",
barColor: "gray",
layout: "vertical",
id: "PopupControl",
androidback: "doClose"
});
I tested this issue with the test code below. I can't reproduce this issue in latest TiSDK. On Android, to specify a semi-transparent [background| http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-property-backgroundColor], set the alpha value using the opacity property before opening the window. Let us know if this helps.
Test Environment
Mac OX S 10.8.5 Ti SDK 3.2.0.GA Ti CLI 3.2.0 Android SDK 4.4Test Code
Step to Test
Create a simple alloy project
Update index.xml with my test code
Run on android device for testing
It will show transparent background
ThanksThat is not the desired behavior. I don't want the foreground to be partially transparent. I want the background to be totally transparent. This worked properly in previous SDKs and it still works on iOS. I have uploaded screenshots from my app using Alloy 1.3.1beta3. Notice on Android how the background is black and on iOS the background (not the foreground) is fully transparent. Android worked like iOS still does in previous versions of Alloy/TI SDK. Did you use Alloy 1.3.1beta3? Please fix it the way it was in the previous versions of the SDK / Alloy.
Do you have a status update on this? This is really important to me. This makes my app unusable. I use this technique a lot in the app. It's difficult to go back to an old SDK because I upgrades to Xcode 5.0.1 not know I would be forced to upgrade Alloy / Titanium SDK and 1.3.0 added a crashing bug that was fixed in beta 3 (ALOY-922). I need to release an update soon. Do you understand that opacity effects the foreground and 'transparent' in the backgroundColor only makes the background transparent. Without this working it makes a whole class of problem unsolvable. Thanks in advance for your help.
Henry, Can you please post a complete test case so that we can easily differentiate the UI behavior pre-1.3 alloy and 1.3+ Once reproduced, we will move this for fix. Regards, Shak
OK. I thought it was obvious from the pictures I posted. I open a window above another window. The new window has a 'transparent' background and you see the content above the window as if floating above the first window.
This is a zip file of a project folder called 'TransparentWindow' that demonstrates the bug. It works on iOS but does not work on Android. The window location is a little off on Android as well, I'm not sure why at this point.
Henry, As a hack, you can get transparent background by setting popup window style:
Result: !http://s28.postimg.org/3rdc8rk7x/unnamed.png!
Thanks! That should at least get me through Beta.
Moving this ticket to engineering as I can reproduce this issue with Android platform while it works correctly for iOS platform. Please use attached test TransparentWindow.zip file for a simple test case. Even though it is an Alloy test case, it is most likely a TIMOB issue.
Why did this work in previous Titanium SDKs on Android. Was it because it used to create a lightweight window instead of a heavy weight window?
Yes, I guess it works fine on lightweight windows.
Use TiTranslucentActivity if the backgroundcolor is transparent or has alpha https://github.com/appcelerator/titanium_mobile/pull/5390
Simple test case to try 'transparent' and alpha-channel var win = Ti.UI.createWindow(); win.backgroundColor = 'white'; var b1 = Ti.UI.createButton({ title : 'Open Window', height : 'auto', width : 'auto' }); // Here is an example of creating the menu handlers in the window creation options. b1.addEventListener('click', function(e) { var w = Ti.UI.createWindow({ backgroundColor : 'transparent' //Comment above line and uncomment the below line to try alpha //backgroundColor : '#5FFF' }); var l = Ti.UI.createLabel({ backgroundColor : 'white', color : 'black', width : 'auto', height : 'auto', text : 'Press the menu button, then select Close Window. You should see a graphic w/ the menu text.' }); w.add(l); w.open({ animated : true}); }); win.add(b1); win.open();
Verified the fix using the above testcase, setting parent window's background color red and child window's as transparent, red background is visible. Verified on: Device : Google Nexus 7, Android Version: 4.4.2 Device: LG-P970, Android version: 4.0.4 SDK: 3.3.0.v20140423155715 CLI version : 3.3.0-dev OS : MAC OSX 10.9.2 Alloy: 1.4.0-dev ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.3.0.201404211130 titanium-code-processor: 1.1.1-alpha XCode : 5.1.1