diff --git a/packages/core/ui/action-bar/index.android.ts b/packages/core/ui/action-bar/index.android.ts index 44a938efb0..7792e5c135 100644 --- a/packages/core/ui/action-bar/index.android.ts +++ b/packages/core/ui/action-bar/index.android.ts @@ -189,6 +189,10 @@ export class ActionBar extends ActionBarBase { this.update(); } + override get needsNativeDrawableFill(): boolean { + return true; + } + public update() { if (!this.nativeViewProtected) { return; diff --git a/packages/core/ui/button/index.android.ts b/packages/core/ui/button/index.android.ts index e3363e35e9..fff4d699c3 100644 --- a/packages/core/ui/button/index.android.ts +++ b/packages/core/ui/button/index.android.ts @@ -106,6 +106,10 @@ export class Button extends ButtonBase { } } + override get needsNativeDrawableFill(): boolean { + return true; + } + [minWidthProperty.getDefault](): CoreTypes.LengthType { const dips = org.nativescript.widgets.ViewHelper.getMinWidth(this.nativeViewProtected); diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts index c963158b3c..2ac9ac685b 100644 --- a/packages/core/ui/core/view/index.android.ts +++ b/packages/core/ui/core/view/index.android.ts @@ -1134,7 +1134,8 @@ export class View extends ViewCommon { nativeView.setBackground(backgroundDrawable); } - if (backgroundDrawable) { + // Apply color to drawables when there is the need to maintain visual things like button ripple effect + if (this.needsNativeDrawableFill && backgroundDrawable) { backgroundDrawable.mutate(); AndroidHelper.setDrawableColor(backgroundColor, backgroundDrawable); diff --git a/packages/core/ui/core/view/index.d.ts b/packages/core/ui/core/view/index.d.ts index 6294fba2cc..d21a4aef13 100644 --- a/packages/core/ui/core/view/index.d.ts +++ b/packages/core/ui/core/view/index.d.ts @@ -781,6 +781,10 @@ export abstract class View extends ViewCommon { * @private */ isLayoutRequired: boolean; + /** + * @private + */ + get needsNativeDrawableFill(): boolean; /** * @private */ diff --git a/packages/core/ui/core/view/view-common.ts b/packages/core/ui/core/view/view-common.ts index d2a7bb30ef..d05e8107ed 100644 --- a/packages/core/ui/core/view/view-common.ts +++ b/packages/core/ui/core/view/view-common.ts @@ -984,6 +984,10 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition { return true; } + get needsNativeDrawableFill(): boolean { + return false; + } + public measure(widthMeasureSpec: number, heightMeasureSpec: number): void { this._setCurrentMeasureSpecs(widthMeasureSpec, heightMeasureSpec); }