diff --git a/tns-core-modules/ui/button/button.android.ts b/tns-core-modules/ui/button/button.android.ts index d8cefeb21..fe1a01f54 100644 --- a/tns-core-modules/ui/button/button.android.ts +++ b/tns-core-modules/ui/button/button.android.ts @@ -1,7 +1,7 @@ import { ButtonBase, TouchGestureEventData, GestureTypes, TouchAction, PseudoClassHandler, - paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length + paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty } from "./button-common"; export * from "./button-common"; @@ -25,7 +25,7 @@ export class Button extends ButtonBase { _button: android.widget.Button; private _highlightedHandler: (args: TouchGestureEventData) => void; private _defaultNativePadding: android.graphics.Rect; - + get android(): android.widget.Button { return this._button; } @@ -96,4 +96,15 @@ export class Button extends ButtonBase { set [paddingLeftProperty.native](value: Length) { org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0)); } + + get [zIndexProperty.native](): number { + return org.nativescript.widgets.ViewHelper.getZIndex(this.nativeView); + } + set [zIndexProperty.native](value: number) { + org.nativescript.widgets.ViewHelper.setZIndex(this.nativeView, value); + // API >= 21 + if (this.nativeView.setStateListAnimator){ + this.nativeView.setStateListAnimator(null); + } + } } \ No newline at end of file diff --git a/tns-core-modules/ui/core/view-common.ts b/tns-core-modules/ui/core/view-common.ts index 2cfdf97d4..0fbda5360 100644 --- a/tns-core-modules/ui/core/view-common.ts +++ b/tns-core-modules/ui/core/view-common.ts @@ -1914,7 +1914,7 @@ function isFloatValueConverter(value: string): number { return newValue; } -export const zIndexProperty = new CssProperty({ name: "zIndex", cssName: "z-index", defaultValue: 0, valueConverter: isFloatValueConverter }); +export const zIndexProperty = new CssProperty({ name: "zIndex", cssName: "z-index", defaultValue: Number.NaN, valueConverter: isFloatValueConverter }); zIndexProperty.register(Style); function opacityConverter(value: any): number {