Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26394] Android: View with borderRadius won't show up semi-transparent

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2019-10-03T11:14:39.000+0000
Affected Version/sRelease 7.0.0, Release 6.3.0, Release 8.0.0, Release 7.3.1
Fix Version/sRelease 8.3.0
ComponentsAndroid
Labelsandroid, backgroundColor, borderRadius, engSchedule, regression
ReporterMichael Gangolf
AssigneeYordan Banev
Created2018-09-16T18:24:25.000+0000
Updated2019-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();

Comments

  1. Sharif AbuDarda 2018-09-16

    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.
  2. Michael Gangolf 2018-09-23

    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
  3. Michael Gangolf 2019-07-20

    Still happening with 8.0.2.GA
  4. Michael Gangolf 2019-09-07

    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
  5. Yordan Banev 2019-09-17

    PR: https://github.com/appcelerator/titanium_mobile/pull/11224
  6. Samir Mohammed 2019-09-25

    FR passed, waiting on Jenkins build.
  7. Sohail Saddique 2019-10-03

    Verified fix. Checked using latest 8.3.0.v20191002165629 build.

JSON Source