Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

On Shell Custom renderer have problem?

$
0
0

On Shell Custom renderer have problem? when I build the project my flyout menu and my bottom navigation tabbar background color are not working ?

custom renderer for bottom navigation tab font size smaller and bigger icon fontsize ? thanks

Project Class

public class CShell: AppShell
{

}

Adroid Class

[assembly: ExportRenderer(typeof(AppShell), typeof(CShellRenderer))]
namespace Goo4.Droid.Renderers
{
public class CShellRenderer : ShellRenderer
{
    public CShellRenderer(Context context) : base(context)
    {
    }
    protected override IShellBottomNavViewAppearanceTracker CreateBottomNavViewAppearanceTracker(ShellItem shellItem)
    {
        return new CBottomNavViewAppearanceTracker();
    }

}


public class CBottomNavViewAppearanceTracker : IShellBottomNavViewAppearanceTracker
{
   public void Dispose()
    {

    }

    public void ResetAppearance(BottomNavigationView bottomView)
    {

    }

    public void SetAppearance(BottomNavigationView bottomView, IShellAppearanceElement appearance)
    {
            IMenu menu = bottomView.Menu;
        for (int i = 0; i < bottomView.Menu.Size(); i++)
        {
            IMenuItem menuItem = menu.GetItem(i);
            var title = menuItem.TitleFormatted;
            SpannableStringBuilder sb = new SpannableStringBuilder(title);

            int a = sb.Length();

            //here I set fontsize 20
            sb.SetSpan(new AbsoluteSizeSpan(11, true), 0, a, SpanTypes.ExclusiveExclusive);

            menuItem.SetTitle(sb);
        }
    }
   }
}

ios Class

[assembly: ExportRenderer(typeof(AppShell), typeof(CShellRenderer))]
namespace Goo4.iOS.Renderers
{
    public class CShellRenderer : ShellRenderer
    {
        public CShellRenderer() : base()
        { }

        protected override IShellTabBarAppearanceTracker CreateTabBarAppearanceTracker()
        {
            return new CTabbarAppearance();
        }
    }

    public class CTabbarAppearance : IShellTabBarAppearanceTracker
    {
        public void Dispose()
        {

        }

        public void ResetAppearance(UITabBarController controller)
        {

        }

        public void SetAppearance(UITabBarController controller, ShellAppearance appearance)
        {

        }

        public void UpdateLayout(UITabBarController controller)
        {

        }
    }
}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



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