Selected tab icon not visible in tabbed page
Thombre, Ashish
105
Reputation points
Issues-
- Selected tab(Resources) icon shows blank, icon should be visible( ref screenshots)
- Previously selected tab(Details) icon color changes to black its should be white (ref screenshots)
Currently using below code for custom handler
public class ScrollableTabbedViewHandler : TabbedViewHandler
{
[Obsolete]
public override void UpdateValue(string property)
{
base.UpdateValue(property);
var tabs = Platform.CurrentActivity?.FindViewById<FragmentContainerView>(Microsoft.Maui.Resource.Id
.navigationlayout_toptabs);
var tabLayout = tabs?.GetChildAt(0);
if (tabLayout is TabLayout layout)
{
layout.TabMode = TabLayout.ModeScrollable;
layout.SetSelectedTabIndicatorColor(Color.FromRgb(44,82,52).ToAndroid());
layout.SetSelectedTabIndicatorHeight(12);
for (int i = 0; i < layout.TabCount; i++)
{
TabLayout.Tab? tab = layout.GetTabAt(i);
TabLayout.TabView? view = tab?.View;
for (int j = 0; j < (view?.ChildCount ?? 0); j++)
{
var child = view?.GetChildAt(j);
if (child is TextView tv)
{
tv.SetAllCaps(false);
}
}
}
}
}
}
In mauiprogram.cs class using below code
ConfigureMauiHandlers((handlers) =>
{
handlers.AddHandler(typeof(TabbedPage), typeof(Platforms.Android.ScrollableTabbedViewHandler));
}