From a7e023cbf997185a2052d92fe75a4045fce5142a Mon Sep 17 00:00:00 2001 From: Alexander Djenkov Date: Thu, 12 Jul 2018 14:05:59 +0300 Subject: [PATCH] fix(layout-params): repspect percentages values (#129) --- .../java/org/nativescript/widgets/CommonLayoutParams.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/widgets/src/main/java/org/nativescript/widgets/CommonLayoutParams.java b/android/widgets/src/main/java/org/nativescript/widgets/CommonLayoutParams.java index 9398b27ca..4ada4c16f 100644 --- a/android/widgets/src/main/java/org/nativescript/widgets/CommonLayoutParams.java +++ b/android/widgets/src/main/java/org/nativescript/widgets/CommonLayoutParams.java @@ -118,7 +118,7 @@ public class CommonLayoutParams extends FrameLayout.LayoutParams { int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK; // If we have explicit height and gravity is FILL we need to be centered otherwise our explicit height won't be taken into account. - if ((lp.height >= 0 || lp.heightPercent >= 0) && verticalGravity == Gravity.FILL_VERTICAL) { + if ((lp.height >= 0 || lp.heightPercent > 0) && verticalGravity == Gravity.FILL_VERTICAL) { verticalGravity = Gravity.CENTER_VERTICAL; } @@ -145,7 +145,7 @@ public class CommonLayoutParams extends FrameLayout.LayoutParams { int horizontalGravity = Gravity.getAbsoluteGravity(gravity, child.getLayoutDirection()) & Gravity.HORIZONTAL_GRAVITY_MASK; // If we have explicit width and gravity is FILL we need to be centered otherwise our explicit width won't be taken into account. - if ((lp.width >= 0 || lp.widthPercent >= 0) && horizontalGravity == Gravity.FILL_HORIZONTAL) { + if ((lp.width >= 0 || lp.widthPercent > 0) && horizontalGravity == Gravity.FILL_HORIZONTAL) { horizontalGravity = Gravity.CENTER_HORIZONTAL; }