diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index e15437296..0397c1ee0 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -552,11 +552,11 @@ function createNativePercentLengthProperty(options: NativePercentLengthPropertyO if (length == "auto") { // tslint:disable-line setPixels(this.nativeView, auto); } else if (typeof length === "number") { - setPixels(this.nativeView, length * layout.getDisplayDensity()); + setPixels(this.nativeView, Math.ceil(length * layout.getDisplayDensity())); } else if (length.unit == "dip") { // tslint:disable-line - setPixels(this.nativeView, length.value * layout.getDisplayDensity()); + setPixels(this.nativeView, Math.ceil(length.value * layout.getDisplayDensity())); } else if (length.unit == "px") { // tslint:disable-line - setPixels(this.nativeView, length.value); + setPixels(this.nativeView, Math.ceil(length.value)); } else if (length.unit == "%") { // tslint:disable-line setPercent(this.nativeView, length.value); } else { diff --git a/tns-core-modules/ui/styling/background.android.ts b/tns-core-modules/ui/styling/background.android.ts index d026a02cc..1f5e3f0c1 100644 --- a/tns-core-modules/ui/styling/background.android.ts +++ b/tns-core-modules/ui/styling/background.android.ts @@ -91,10 +91,10 @@ export module ad { // TODO: Can we move BorderWidths as separate native setter? // This way we could skip setPadding if borderWidth is not changed. - let leftPadding = Math.round(view.effectiveBorderLeftWidth + view.effectivePaddingLeft); - let topPadding = Math.round(view.effectiveBorderTopWidth + view.effectivePaddingTop); - let rightPadding = Math.round(view.effectiveBorderRightWidth + view.effectivePaddingRight); - let bottomPadding = Math.round(view.effectiveBorderBottomWidth + view.effectivePaddingBottom); + let leftPadding = Math.ceil(view.effectiveBorderLeftWidth + view.effectivePaddingLeft); + let topPadding = Math.ceil(view.effectiveBorderTopWidth + view.effectivePaddingTop); + let rightPadding = Math.ceil(view.effectiveBorderRightWidth + view.effectivePaddingRight); + let bottomPadding = Math.ceil(view.effectiveBorderBottomWidth + view.effectivePaddingBottom); nativeView.setPadding( leftPadding, diff --git a/tns-core-modules/ui/styling/style-properties.ts b/tns-core-modules/ui/styling/style-properties.ts index cedb843e6..8e9e8614c 100644 --- a/tns-core-modules/ui/styling/style-properties.ts +++ b/tns-core-modules/ui/styling/style-properties.ts @@ -59,16 +59,16 @@ function toDevicePixelsCommon(length: PercentLength, auto: number, parentAvailab return auto; } if (typeof length === "number") { - return Math.round(layout.getDisplayDensity() * length); + return Math.ceil(layout.getDisplayDensity() * length); } switch (length.unit) { case "px": - return Math.round(length.value); - default: - case "dip": - return Math.round(layout.getDisplayDensity() * length.value); + return Math.ceil(length.value); case "%": return Math.round(parentAvailableWidth * length.value); + case "dip": + default: + return Math.ceil(layout.getDisplayDensity() * length.value); } }