title: How to change TabbedPage Icon when the tab is reselected in Android?
body: <p>I have an application using <code>Xamarin Forms</code> <code>TabbedPage</code> which has a feature that would allow the user to pause and play a page. Please see the code below.</p>
  
  <p><strong>Shared Code</strong></p>
  
  <pre><code>public partial class MainPage : TabbedPage
  {
     public MainPage()
     {
        InitializeComponent();
  
        var homePage = new NavigationPage(new HomePage())
        { 
           Title = "Home",
           Icon = "ionicons_2_0_1_home_outline_25.png"
        };
  
        var phrasesPage = new NavigationPage(new PhrasesPage())
        {
           Title = "Play",
           Icon = "ionicons_2_0_1_play_outline_25.png"
         };
  
         Children.Add(homePage);
         Children.Add(phrasesPage);
     }
  }
  </code></pre>
  
  <p><strong>In iOS renderer:</strong></p>
  
  <pre><code>public class TabbedPageRenderer : TabbedRenderer
  {
     private MainPage _page;
     protected override void OnElementChanged(VisualElementChangedEventArgs e)
    {
        base.OnElementChanged(e);
        var tabbarController = (UITabBarController)this.ViewController;
        if (null != tabbarController)
        {
           tabbarController.ViewControllerSelected += OnTabBarReselected;
         }
     }
  
     void OnTabBarReselected(object sender, UITabBarSelectionEventArgs e)
     {
        var tabs = Element as TabbedPage;
        var playTab = tabs.Children[4];
  
        if (TabBar.SelectedItem.Title == "Play") {
           if (tabs != null)
           {
              playTab.Title = "Pause";
              playTab.Icon = "ionicons_2_0_1_pause_outline_22.png";
           }
           App.pauseCard = false;
         }
         else {
          if (tabs != null) {
             playTab.Title = "Play";
             playTab.Icon = "ionicons_2_0_1_play_outline_25.png";
         }
         App.pauseCard = true;
      }
  }
  </code></pre>
  
  <p><strong>Android Renderer</strong></p>
  
  <pre><code>public class MyTabbedPageRenderer: TabbedPageRenderer, TabLayout.IOnTabSelectedListener
  {
      if (e.PropertyName == "Renderer")
      {
         viewPager = (ViewPager)ViewGroup.GetChildAt(0);
         tabLayout = (TabLayout)ViewGroup.GetChildAt(1);
         setup = true;
  
         ColorStateList colors = null;
         if ((int)Build.VERSION.SdkInt &gt;= 23)
         {
             colors = Resources.GetColorStateList(Resource.Color.icon_tab, Forms.Context.Theme);
         }
         else
         {
             colors = Resources.GetColorStateList(Resource.Color.icon_tab);
         }
  
         for (int i = 0; i &lt; tabLayout.TabCount; i++)
         {
             var tab = tabLayout.GetTabAt(i);
             var icon = tab.Icon;
             if (icon != null)
             {
                 icon = Android.Support.V4.Graphics.Drawable.DrawableCompat.Wrap(icon);
                 Android.Support.V4.Graphics.Drawable.DrawableCompat.SetTintList(icon, colors);
             }
         }
     }
  
     void TabLayout.IOnTabSelectedListener.OnTabReselected(TabLayout.Tab tab)
     {
        var tabs = Element as TabbedPage;
        var playTab = tabs.Children[4];
        var selectedPosition = tab.Position;
  
        if(selectedPosition == 4) 
        {
           if (playTab.Title == "Play")
           {
              if (tabs != null)
              {
                 playTab.Title = "Pause";
                 playTab.Icon = "ionicons_2_0_1_pause_outline_22.png";
              }
              App.pauseCard = false;
            }
            else
            {
               if (tabs != null)
               {
                  playTab.Title = "Play";
                  playTab.Icon = "ionicons_2_0_1_play_outline_25.png";
               }
               App.pauseCard = true;
             }
           }
      }
  }
  </code></pre>
  
  <p>This is perfectly working in <code>iOS</code>. But somehow in <code>Android</code> only the <code>Title</code> would change but not the <code>Icon</code>. Anyone knows what Im missing or how it should be done? Also, is this possible to be done in the shared code instead of repeating almost exactly the same lines on code in each platform?</p>