[TIMOB-26394] Android: View with borderRadius won't show up semi-transparent
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-10-03T11:14:39.000+0000 |
Affected Version/s | Release 7.0.0, Release 6.3.0, Release 8.0.0, Release 7.3.1 |
Fix Version/s | Release 8.3.0 |
Components | Android |
Labels | android, backgroundColor, borderRadius, engSchedule, regression |
Reporter | Michael Gangolf |
Assignee | Yordan Banev |
Created | 2018-09-16T18:24:25.000+0000 |
Updated | 2019-10-03T11:14:39.000+0000 |
Description
*Problem:*
A view that has a borderRadius won't respect the backgroundColor transparency. It will show up as a solid color.
*Code:*
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var v1 = Titanium.UI.createView({
backgroundColor: 'rgba(0,0,0,0.5)',
height: 100,
width: Ti.UI.FILL,
borderRadius: 20
});
win.add(v1);
win.open();
*Affected versions*
tested 7.0.0.GA to 7.3.1.GA and all versions are affected by the bug
*Device*
HTC A9, Android 7
*Workaround:*
Using a second view inside the rounded view with a transparent background works:
var win = Ti.UI.createWindow({
backgroundColor: '#fff'
});
var v1 = Titanium.UI.createView({
height: 100,
width: Ti.UI.FILL,
borderRadius: 20
});
var v2 = Titanium.UI.createView({
backgroundColor: 'rgba(0,0,0,0.5)',
height: 100,
width: Ti.UI.FILL
});
v1.add(v2);
win.add(v1);
win.open();
Hello, I was able to reproduce the issue as described in Android with the 7.x.x.GA. View borderRadius won't respect the backgroundColor transparency in Android. iOS is fine. Thanks.
Could track this down to: https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/view/TiUIView.java#L1451 This PR changed some parts in there: https://github.com/appcelerator/titanium_mobile/pull/9159 When I comment out these two lines (borderView.setBgColor(bgColor); borderView.setColor(bgColor); ) it works as expected. But I'm not 100% sure if that would have side-effects. But since the borderView should just be used to clip the view I don't even know why to set the backgroundColor of it
Still happening with 8.0.2.GA
Quick update: still the same in 8.1.0.GA. Would be good if some has a look at the comment above to get the parity back to work
PR: https://github.com/appcelerator/titanium_mobile/pull/11224
FR passed, waiting on Jenkins build.
Verified fix. Checked using latest 8.3.0.v20191002165629 build.