diff --git a/api-reports/NativeScript.api.md b/api-reports/NativeScript.api.md index f6f2c8e68..fb7e0cbb4 100644 --- a/api-reports/NativeScript.api.md +++ b/api-reports/NativeScript.api.md @@ -2197,6 +2197,8 @@ export class TabContentItem extends ContentView { export class TabNavigationBase extends View { android: any /* android.view.View */; + getTabBarBackgroundArgbColor(): any + getTabBarBackgroundColor(): any getTabBarColor(): any diff --git a/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts b/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts index 077a4096c..ce3bfd17d 100644 --- a/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts +++ b/nativescript-core/ui/bottom-navigation/bottom-navigation.android.ts @@ -578,9 +578,7 @@ export class BottomNavigation extends TabNavigationBase { // BACKGROUND-COLOR const backgroundColor = tabStripItem.style.backgroundColor; - if (backgroundColor) { - tabItemSpec.backgroundColor = backgroundColor.android; - } + tabItemSpec.backgroundColor = backgroundColor ? backgroundColor.android : this.getTabBarBackgroundArgbColor(); // COLOR const color = titleLabel.style.color; diff --git a/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.d.ts b/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.d.ts index 1a6b24418..7440e23e6 100644 --- a/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.d.ts +++ b/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.d.ts @@ -90,6 +90,12 @@ export class TabNavigationBase extends View { */ getTabBarBackgroundColor(): any + /** + * @private + * Method is intended to be overridden by inheritors and used as "protected" + */ + getTabBarBackgroundArgbColor(): any + /** * @private * Method is intended to be overridden by inheritors and used as "protected" diff --git a/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts b/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts index eb8d96ed0..ee035bf1f 100644 --- a/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts +++ b/nativescript-core/ui/tab-navigation-base/tab-navigation-base/tab-navigation-base.ts @@ -113,6 +113,13 @@ export class TabNavigationBase extends View implements TabNavigationBaseDefiniti return null; } + public getTabBarBackgroundArgbColor(): any { + // This method is implemented only for Android + const colorDrawable = this.getTabBarBackgroundColor(); + + return colorDrawable && colorDrawable.getColor && colorDrawable.getColor(); + } + public setTabBarBackgroundColor(value: any): void { // overridden by inheritors } diff --git a/nativescript-core/ui/tabs/tabs.android.ts b/nativescript-core/ui/tabs/tabs.android.ts index 3659eed9a..6008b7980 100644 --- a/nativescript-core/ui/tabs/tabs.android.ts +++ b/nativescript-core/ui/tabs/tabs.android.ts @@ -653,9 +653,7 @@ export class Tabs extends TabsBase { // BACKGROUND-COLOR const backgroundColor = tabStripItem.style.backgroundColor; - if (backgroundColor) { - tabItemSpec.backgroundColor = backgroundColor.android; - } + tabItemSpec.backgroundColor = backgroundColor ? backgroundColor.android : this.getTabBarBackgroundArgbColor(); // COLOR const color = nestedLabel.style.color;