Код: Выделить всё
@style/MB.BottomNavigationStyle
labeled
@style/MB.BottomNavText
@style/MB.BottomNavText
12sp
normal
< /code>
не работал, я также попытался добавить Dimens.xml, что -то, что ранее работало, когда приложение находилось в Xamarin, но это тоже не летало. < /p>
12sp
12sp
12sp
12sp
12sp
0dp
0dp
< /code>
Я также должен упомянуть, что я использую следующий код, чтобы переключить значок на моем вкладках < /p>
static FontImageSource MakeIcon(
string family,
string glyph,
Color color,
double size)
=> new()
{
FontFamily = family,
Glyph = glyph,
Color = color,
Size = size > 0 ? size : 24
};
void UpdateTabIcons()
{
// The currently selected ShellItem is your TabBar
var currentTabBar = CurrentItem as TabBar;
var selectedSection = currentTabBar?.CurrentItem; // the selected Tab (ShellSection)
foreach (var shellItem in Items)
{
if (shellItem is not TabBar tabBar) continue;
foreach (var section in tabBar.Items)
{
// Your is a ShellSection at runtime
if (section is not Tab tab) continue;
if (tab.Icon is not FontImageSource fis) continue;
var isSelected = ReferenceEquals(section, selectedSection);
// Swap Thin/Regular by selection; keep same glyph/color/size
var targetFamily = isSelected ? "FASolid" : "FAThin";
if (!string.Equals(fis.FontFamily, targetFamily, StringComparison.Ordinal))
{
tab.Icon = MakeIcon(
family: targetFamily,
glyph: fis.Glyph ?? string.Empty,
color: fis.Color,
size: fis.Size
);
}
}
}
}
< /code>
Это вызывается из конструктора моего appshall.xaml.cs. Я также думаю, что это замедляет навигацию, потому что я называю это таким образом из указанного конструктора: < /p>
public AppShell()
{
InitializeComponent();
Routing.RegisterRoute(nameof(FeaturedNewsPage), typeof(FeaturedNewsPage));
UpdateTabIcons();
// react whenever navigation changes the selected tab
Navigated += (_, __) => UpdateTabIcons();
}
< /code>
Вот фрагмент того, как выглядит моя вкладка от Appshell.xaml < /p>
Подробнее здесь: https://stackoverflow.com/questions/797 ... ui-android