locked
Changing TabbedPage Tab Colors on Android RRS feed

  • Question

  • User60022 posted

    I cant for the life of me find out how to change the TabbedPage Tab Colors on Forms 1.4+ using an implicit style in code.

    I can set the BarBackgroundColor on a NavigationPage but the same options dont exist on TabbedPages.

    ```

    var navigationPagesStyle = new Style(typeof(NavigationPage)) { Setters = { new Setter { Property = VisualElement.BackgroundColorProperty, Value = NavigationPages.BackgroundColor }, new Setter { Property = NavigationPage.BarBackgroundColorProperty, Value = NavigationPages.BarBackgroundColor }, new Setter { Property = NavigationPage.BarTextColorProperty, Value = NavigationPages.BarTextColor } } }; if (NavigationPages.key == null) { Application.Current.Resources.Add(navigationPagesStyle); } else { Application.Current.Resources.Add(NavigationPages.key, navigationPagesStyle); }

    ```

    I think I need to know the new Style(typeof(OBJECT)) but I dont know what the proper OBJECT is to put in there.

    Anyone have any suggestions? I cant figure out how to change it in a custom renderer either as Android.App.ActionBar.Tab is obsolete now. Thanks M

    Thursday, August 27, 2015 4:25 PM

All replies

  • User105524 posted

    I used custom tabs in my opensource. You can change color and placing as per your need https://github.com/asthanarht/CPXamarin

    Friday, August 28, 2015 5:42 AM
  • User60022 posted

    Thanks @rohitasthana interesting idea but I was hoping to simply use the existing TabbedPage.

    No one knows where the Android.App.ActionBar.Tab moved to?

    Friday, August 28, 2015 3:51 PM
  • User103333 posted

    Hi @MikeRowley403

    To achieve that you need to set themes and styles: http://jgilfelt.github.io/android-actionbarstylegenerator/ http://android-holo-colors.com/

    Those styles lives in the android project, and they are XML files.

    In this thread @JohnMiller answered and I complemented it

    Hope this helps!

    Friday, August 28, 2015 4:36 PM
  • User60022 posted

    Thanks @MiguelCervantes however I have already read that post and I am trying to determine if this can be done outside of resources and set implicitly in code as above in the NavigationPage.

    Friday, August 28, 2015 4:56 PM
  • User103333 posted

    The sad news is you can't. If you want to do it in code you need a custom renderer.

    Friday, August 28, 2015 5:13 PM
  • User60022 posted

    Perfect, that is exactly what I came to this morning as well. However I cant figure out what to change in the Custom Renderer as Android.App.ActionBar.Tab is obsolete. I am looking for what I need to change in the custom renderer to change the tab colors.

    Friday, August 28, 2015 5:16 PM
  • User300571 posted

    Did this get resolved?

    Friday, February 17, 2017 9:37 AM