mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Merge pull request #3454 from NativeScript/z-index
Fix zIndex for Android buttons
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1914,7 +1914,7 @@ function isFloatValueConverter(value: string): number {
|
||||
return newValue;
|
||||
}
|
||||
|
||||
export const zIndexProperty = new CssProperty<Style, number>({ name: "zIndex", cssName: "z-index", defaultValue: 0, valueConverter: isFloatValueConverter });
|
||||
export const zIndexProperty = new CssProperty<Style, number>({ name: "zIndex", cssName: "z-index", defaultValue: Number.NaN, valueConverter: isFloatValueConverter });
|
||||
zIndexProperty.register(Style);
|
||||
|
||||
function opacityConverter(value: any): number {
|
||||
|
Reference in New Issue
Block a user