feat(android): optimize borderRadius#13500
Conversation
|
Hi @m1ga that's great PR I was working on it recently. |
|
@AhmedMSayed sounds awesome! Still have the |
|
@AhmedMSayed I've tried a shapeDrawable too but still have issues with ImageViews const win = Ti.UI.createWindow({ title: "Select Time", backgroundColor:"#ddd" });
var view = Ti.UI.createView({
width: 100,
height: 100,
borderRadius: 50,
left: 10,
backgroundColor:"red",
elevation: 50,
borderWidth:10,
borderColor: "#00f"
})
const img = Ti.UI.createImageView({
image:"/images/bg_intro.jpg",
borderRadius: 50,
height: 100,
width: 100,
right: 10,
elevation: 50,
borderWidth:10,
borderColor: "#f00"
});
win.add([img,view]);
var img_check1 = Ti.UI.createImageView({
width: 100,
height: 100,
bottom: 10,
left: 10
})
var img_check2 = Ti.UI.createImageView({
width: 100,
height: 100,
bottom: 10,
right: 10
})
win.add(img_check1);
win.add(img_check2);
setTimeout(function(){
img_check1.image = view.toImage();
img_check2.image = img.toImage();
}, 3000)
win.open();normal view works fine but the imageview will lose the shape when doing |
|
Think I finally figured it out! Old views with border radius = So I'm able to get rid of one nested element and still can do a |
|
closing in favor of #14451 |



fixes #13464
Work in progress
When setting
optimizeBorderRadius:truethe view will use theViewOutlineProviderto set the borderRadius. That will remove one nested view:Before this PR:

After this PR (BorderWrapperView is gone):

It only works if:
optimizeBorderRadiusis trueborderRadiusis one integer valueborderWidthis usedotherwise the old way is used. Especially in a ListView with many circular profile pictures it flattens the hierarchy.
I would love to use it without the property but I have one issue:
toImage()won't theViewOutlineProviderso all elements that automatically use the new way would look wrong. I've added the property so a user can activate the optimized rendering if he knows that there won't be anytoImage()calls.I'm still trying to either get
toImage()to work or rerender the view with the old way when the user usestoImage().toImagetest: