I got this for my navigation:
<TabbedPage ....
<TabbedPage.Children>
<NavigationPage Title=" MY_TITLE_1 ">
<NavigationPage.Icon>
<OnPlatform x:TypeArguments="FileImageSource">
<On Platform="Android" Value="icon1.png" />
<On Platform="iOS" Value="icon1.png" />
</OnPlatform>
</NavigationPage.Icon>
</NavigationPage>
<NavigationPage Title=" MY_TITLE_2 ">
....
</TabbedPage>
The problem is that , when I put 4 or 5 tabs my text is hidden , and I need to click on the tab in order to see the text ( in other words I see only the text of the tab that is clicked ).
In iOS the text is always visible. Is there any way to make it in Android too?
SOLVED: This article did the trick for me. The solution was to turn off shifting.
https://montemagno.com/xamarin-forms-fully-customize-bottom-tabs-on-android-turn-off-shifting/
In summary, I updated
Xamarin.Android.Support.Core.Utils, Xamarin.Android.Support.CustomTabs, Xamarin.Android.Support.Design, Xamarin.Android.Support.v4, Xamarin.Android.Support.v7.AppCombat, Xamarin.Android.Support.7.cardView, Xamarin.Android.Support.v7.MediaRouter
I made this file in Android solution:
using Android.Support.Design.BottomNavigation;
using Android.Support.Design.Widget;
using Android.Views;
using App16.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly:ResolutionGroupName ("MyCompany")]
[assembly:ExportEffect (typeof(NoShiftEffect), "NoShiftEffect")]
namespace App16.Droid
{
public class NoShiftEffect : PlatformEffect
{
protected override void OnAttached ()
{
if (!(Container.GetChildAt(0) is ViewGroup layout))
return;
if (!(layout.GetChildAt(1) is BottomNavigationView bottomNavigationView))
return;
// This is what we set to adjust if the shifting happens
bottomNavigationView.LabelVisibilityMode = LabelVisibilityMode.LabelVisibilityLabeled;
}
protected override void OnDetached ()
{
}
}
}
In the shared solution :
using Xamarin.Forms;
namespace App16
{
public class NoShiftEffect : RoutingEffect
{
public NoShiftEffect() : base("MyCompany.NoShiftEffect")
{
}
}
}
and this in my XAML:
<TabbedPage.Effects>
<local:NoShiftEffect />
</TabbedPage.Effects>