mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Use software layer for rounded borders on android 17
This commit is contained in:
@ -13,6 +13,8 @@ var btn;
|
||||
|
||||
global.moduleMerge(stylersCommon, exports);
|
||||
|
||||
var SDK = android.os.Build.VERSION.SDK_INT;
|
||||
|
||||
var ignorePropertyHandler = new stylersCommon.StylePropertyChangedHandler(
|
||||
(view, val) => {
|
||||
// empty
|
||||
@ -51,6 +53,12 @@ function onBackgroundOrBorderPropertyChanged(v: view.View) {
|
||||
bkg.cornerRadius = v.borderRadius;
|
||||
bkg.borderColor = v.borderColor ? v.borderColor.android : android.graphics.Color.TRANSPARENT;
|
||||
bkg.background = backgroundValue;
|
||||
|
||||
if (SDK < 18) {
|
||||
// Switch to software because of unsupported canvas methods if hardware acceleration is on:
|
||||
// http://developer.android.com/guide/topics/graphics/hardware-accel.html
|
||||
nativeView.setLayerType(android.view.View.LAYER_TYPE_SOFTWARE, null);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// reset the value with the default native value
|
||||
@ -64,6 +72,11 @@ function onBackgroundOrBorderPropertyChanged(v: view.View) {
|
||||
nativeView.setBackground(_defaultBackgrounds.get(viewClass));
|
||||
}
|
||||
}
|
||||
|
||||
if (SDK < 18) {
|
||||
// Reset layer type to hardware
|
||||
nativeView.setLayerType(android.view.View.LAYER_TYPE_HARDWARE, null);
|
||||
}
|
||||
}
|
||||
|
||||
var density = utils.layout.getDisplayDensity();
|
||||
|
Reference in New Issue
Block a user