Reputation: 1387
I am new to Xamarin mobile app development. I got a task to add navigation menu with their titles and Icons.
I am doing Code based UI for development, and here is the below code where I create navigation Menu.
public MainPage ()
{
BindingContext = new MainViewModel(this);
this.Children.Add(new FirstTab() {Icon= "firsttab.png", Title="First Tab" });
this.Children.Add(new SecondTab() {Icon= "secondtab.png", Title="Second Tab" });
this.Children.Add(new ThirdTab() {Icon= "thirdtab.png", Title="Third Tab" });
this.CurrentPageChanged += MainPage_CurrentPageChanged;
this.Title = this.CurrentPage.Title;
}
I am getting navigation menu with all the three tabs but only with their Titles
Icons are not showing up.
I also read the this blog but no result.
Can anyone help me how to get this done or where I am doing wrong? Thank You
Upvotes: 3
Views: 1067
Reputation: 9084
Menu Icons is not showing up in Xamarin.Android App
Update your Xamarin.Forms
to 2.4.0.282
or later, the icon will show up.
In my code:
MainPage = new TabbedPage1();
...
public partial class TabbedPage1 : TabbedPage
{
public TabbedPage1 ()
{
InitializeComponent();
this.Children.Add(new ContentPage() { Icon = "icon.png", Title = "First Tab" });
this.Children.Add(new ContentPage() { Icon = "icon.png", Title = "Second Tab" });
this.Children.Add(new ContentPage() { Icon = "icon.png", Title = "Third Tab" });
}
}
My Xamarin.Forms
version is 2.4.0.282, Effect.
Upvotes: 2