Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Custom TabbedRenderer to set tab text color on Android

$
0
0

I found an iOS render:

but I can't seem to find a similar Android rendered to set to set the tab text color. I found a bunch of posts that reference things like background color:

but nothing for tab text color.

// http://forums.xamarin.com/discussion/comment/80381/#Comment_80381       
public class CustomTabRenderer : TabbedRenderer
{
    private Activity activity;
    private bool isFirstDesign = true;

    protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);
        activity = this.Context as Activity;
    }

    protected override void OnWindowVisibilityChanged(ViewStates visibility)
    {
        base.OnWindowVisibilityChanged(visibility);
        if (isFirstDesign)
        {
            ActionBar actionBar = activity.ActionBar;

            ColorDrawable colorDrawable = new ColorDrawable(Color.White);
            actionBar.SetStackedBackgroundDrawable(colorDrawable);

            // TODO: set tab text color

            isFirstDesign = false; 
        }
    }
}

Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>