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

Centered Icon-only Tabs on Android

$
0
0

Hi,

I'm looking to remove the text from the tabs (and vertically center the icon) in my Xamarin Forms app, like this:


I achieved this on iOS by making the TextColor clear and shifting the image down:

    public override void ViewWillLayoutSubviews()
    {
        base.ViewWillLayoutSubviews();

        if (TabBar != null)
        {
            foreach (var item in TabBar.Items)
            {
                item.ImageInsets = new UIEdgeInsets(5, 0, -5, 0);
            }
        }
    }

Right now my tabs on Android look like this:

If it matters, it's been set it to the bottom of the screen like so:

    public MyTabbedPage()
    {
        On<Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);
    }

How can I remove the text and center the icon on the Android tab bar? I've played around with the styles and axml but I'm not really getting anywhere.

Thanks!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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