mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 05:18:39 +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 {
|
import {
|
||||||
ButtonBase, TouchGestureEventData, GestureTypes, TouchAction,
|
ButtonBase, TouchGestureEventData, GestureTypes, TouchAction,
|
||||||
PseudoClassHandler,
|
PseudoClassHandler,
|
||||||
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length
|
paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty
|
||||||
} from "./button-common";
|
} from "./button-common";
|
||||||
|
|
||||||
export * from "./button-common";
|
export * from "./button-common";
|
||||||
@ -96,4 +96,15 @@ export class Button extends ButtonBase {
|
|||||||
set [paddingLeftProperty.native](value: Length) {
|
set [paddingLeftProperty.native](value: Length) {
|
||||||
org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeView, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0));
|
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;
|
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);
|
zIndexProperty.register(Style);
|
||||||
|
|
||||||
function opacityConverter(value: any): number {
|
function opacityConverter(value: any): number {
|
||||||
|
Reference in New Issue
Block a user