Forum Xamarin.Android

Why do the tabs in TabbedPage inherit from Material.Light.DarkActionBar?

QuakeulfQuakeulf NOMember ✭✭✭

(Sorry if this is a duplicate but something went wrong when I first posted this.)

...and how can I override this? This is for a PCL-project with the latest version of Xamarin.

I am trying styles.xml with a custom theme but I can literally type anything in them (both values and values-v21) and still have the app compile and run like they're not being used correctly. I am using the guide here:

In the code I set a style for a TabbedPage like this:

public static Style Tabbed = new Style(typeof(TabbedPage)) { Setters = { new Setter { Property = TabbedPage.BackgroundColorProperty, Value = Styling.Colors.Grey }, new Setter { Property = TabbedPage.BarBackgroundColorProperty, Value = Styling.Colors.Grey }, new Setter { Property = TabbedPage.BarTextColorProperty, Value = Styling.Colors.NormalText } } };
This works as intended on iOS, but on Android the Material-theme overrides everything and I cannot set the colours.

In both the styles.xml I set colours like this:
<item name="android:colorPrimary">@color/wan</item> <item name="android:colorPrimaryDark">@color/tsuu</item> <item name="android:colorAccent">@color/tsurii</item>
Which get the colours from the colors.xml-file like this:
<color name="wan">#3498DB</color> <color name="tsuu">#77D065</color> <color name="tsurii">#B455B6</color>
(These colours are just lifted from the guide and do not reflect the intentional colours.)

I fail to see why DarkActionBar should have any influence on a tabbed page. I also fail to find ways to override this. If the code here worked as intended like it does on iOS then everything would be fine. Yet somewhere something is deciding to ignore everything I do for the Android-part of the project.

Please help. I have spent far too many hours on this.

Sign In or Register to comment.