英文:
How to change the FontSize and icons size of .net Maui iOS AppShell TabBar?
问题
我有这个AppShell:
<Shell.Resources>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor" Value="{DynamicResource YouviRed}" />
<Setter Property="Shell.ForegroundColor" Value="White" />
<Setter Property="Shell.TitleColor" Value="White" />
<Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
<Setter Property="Shell.NavBarIsVisible" Value="False" />
</Style>
</Shell.Resources>
<TabBar>
<ShellContent Title="{ext:Translate Dashboard}" Style="{StaticResource BaseStyle}" Icon="dashboard.png" ContentTemplate="{DataTemplate navi:CustomNavigationPage}" Route="Dashboard">
<dash:DashboardView/>
</ShellContent>
<ShellContent Title="{ext:Translate Rooms}" Style="{StaticResource BaseStyle}" Icon="rooms.png" ContentTemplate="{DataTemplate navi:CustomNavigationPage}" Route="Rooms">
<rooms:RoomsView/>
</ShellContent>
<ShellContent Title="{ext:Translate Settings}" Style="{StaticResource BaseStyle}" Icon="settings.png" ContentTemplate="{DataTemplate navi:CustomNavigationPage}" Route="Settings">
<sett:SettingsView />
</ShellContent>
</TabBar>
iOS TabBar的标题字体太小,图标太大,我不知道如何更改这个。我需要一个特定的处理程序吗,还是有其他更好的方法?非常感谢任何帮助,提前致谢。
英文:
I have this AppShell:
<Shell.Resources>
<Style x:Key="BaseStyle"
TargetType="Element">
<Setter Property="Shell.BackgroundColor"
Value="{DynamicResource YouviRed}" />
<Setter Property="Shell.ForegroundColor"
Value="White" />
<Setter Property="Shell.TitleColor"
Value="White" />
<Setter Property="Shell.DisabledColor"
Value="#B4FFFFFF" />
<Setter Property="Shell.UnselectedColor"
Value="#95FFFFFF" />
<Setter Property="Shell.NavBarIsVisible"
Value="False" />
</Style>
</Shell.Resources>
<TabBar>
<ShellContent Title="{ext:Translate Dashboard}"
Style="{StaticResource BaseStyle}"
Icon="dashboard.png"
ContentTemplate="{DataTemplate navi:CustomNavigationPage}"
Route="Dashboard" >
<dash:DashboardView/>
</ShellContent>
<ShellContent Title="{ext:Translate Rooms}"
Style="{StaticResource BaseStyle}"
Icon="rooms.png"
ContentTemplate="{DataTemplate navi:CustomNavigationPage}"
Route="Rooms" >
<rooms:RoomsView/>
</ShellContent>
<ShellContent Title="{ext:Translate Settings}"
Style="{StaticResource BaseStyle}"
Icon="settings.png"
ContentTemplate="{DataTemplate navi:CustomNavigationPage}"
Route="Settings" >
<sett:SettingsView />
</ShellContent>
</TabBar>
The Titles fontSize of the iOS TabBar are to small and the icons are to big, I don't know how to change this. Did I need an specific Handler for this or did anyone knows an better way ? I would be very grateful for any help, thanks in advance.
答案1
得分: 1
Set the BaseSize of svg file works for me.
You could add the line in csproj file:
<MauiImage Update="Resources\Images\airplane.svg" BaseSize="50,50" />
You could control the size by change to BaseSize="30,30"
or other value. So the Build action of SVG file is MauiImage.
As far as i know we could not change the font size of shell Tabbar. See this thread: How to change Tab title font for TabBar in .NET MAUI. You could also raise an issue on Github.
Hope it works.
英文:
Set the BaseSize of svg file works for me.
You could add the line in csproj file:
<MauiImage Update="Resources\Images\airplane.svg" BaseSize="50,50" />
You could control the size by change to BaseSize="30,30"
or other value. So the Build action of SVG file is MauiImage.
As far as i know we could not change the font size of shell Tabbar. See this thread: How to change Tab title font for TabBar in .NET MAUI. You could also raise an issue on Github.
Hope it works.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论