1
votes

How would I accomplish tinting the tab bar of a TabbedPage in Xamarin.Forms? The TabbedPage doesn't seem to expose a property or method to set the tint directly.

Every child page of my TabbedPage is a NavigationPage. Setting the "Tint" of the NavigationPage adjusts the nav bar, setting the "BackgroundColor" of those same NavigationPage children adjusts the tab bar in a very subtle way (seems to be a mix of the color I choose and some extreme opacity). This is on iOS specifically.

How can I set it to the actual color I am specifying for the BackgroundColor, so that I can have it match the nav bar Tint.

1

1 Answers

0
votes

Create new file in Xamarin.Android/Values/Styles.xml and add code:

<?xml version="1.0" encoding="UTF-8" ?>
<resources>
    <style name="MyTheme"
           parent="@android:style/Theme.Holo">
        <item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
    </style>

    <style name="MyActionBarTabText"
           parent="@android:style/Widget.Holo.ActionBar.TabText">
        <item name="android:textColor">#FFFFFF</item>
    </style>
</resources>

And in MainActivity add code:

[Activity(Label = "Bla Bla", MainLauncher = true,Theme = "@style/MyTheme",
    WindowSoftInputMode = Android.Views.SoftInput.AdjustPan)]