【发布时间】:2022-06-22 10:34:18
【问题描述】:
我正在使用 Xamarin.Forms.Shell 开发一个用于布局和导航的应用程序。当我在 TabBar 中使用更多的五个选项卡时,自然会出现更多按钮,即每个平台(Android 和 iOS)的原生。但是,同样在 xaml 中为 Shell.Background 和 Shell.TabBarBackground 使用自定义颜色,不适用于更多按钮的选项卡背景。
我在 Xaml APP SHELL 中的代码:
<Shell.Resources>
<ResourceDictionary>
<Style x:Key="BaseStyle" TargetType="Element">
<Setter Property="Shell.BackgroundColor"
Value="{x:Static core:Colors.Background}" />
<Setter Property="Shell.ForegroundColor"
Value="White" />
<Setter Property="Shell.TabBarBackgroundColor"
Value="{x:Static core:Colors.Background}" />
<Setter Property="Shell.TabBarTitleColor"
Value="{x:Static core:Colors.Selection}" />
<Setter Property="Shell.TabBarUnselectedColor"
Value="White" />
</Style>
</ResourceDictionary>
</Shell.Resources>
<ShellItem Route="Home">
<ShellContent ContentTemplate="{DataTemplate core:HomePage}"/>
</ShellItem>
<TabBar Route="Tabs" Style="{x:StaticResource BaseStyle}">
<Tab Route="TabSearch"
Icon="ic_list_white"
Title="Search">
<ShellContent ContentTemplate="{DataTemplate core:SearchPage}"/>
</Tab>
<Tab
Icon="ic_filter_list_white"
Title="Filter">
<ShellContent ContentTemplate="{DataTemplate core:FilterPage}"/>
</Tab>
<Tab Icon="ic_star_white"
Title="Favourites">
<ShellContent ContentTemplate="{DataTemplate core:FavouritesPage}"/>
</Tab>
<Tab Icon="ic_remove_red_eye_white"
Title="Seen">
<ShellContent ContentTemplate="{DataTemplate core:SeenPage}"/>
</Tab>
<Tab Icon="ic_shopping_cart_white" Title="{x:Static resources:Strings.MAINPAGE_MENU_PURCHASE_PACKAGES}">
<ShellContent ContentTemplate="{DataTemplate core:PackagePurchasePage}"/>
</Tab>
<Tab Icon="ic_sync_white" Title="{x:Static resources:Strings.MAINPAGE_MENU_RESTORE_PURCHASES}" >
<ShellContent ContentTemplate="{DataTemplate core:RestorePurchasePage}"/>
</Tab>
<Tab Icon="ic_settings_white" Title="{x:Static resources:Strings.MAINPAGE_MENU_SETTINGS}" >
<ShellContent ContentTemplate="{DataTemplate core:SettingsPage}"/>
</Tab>
<Tab Icon="ic_help_white" Title="{x:Static resources:Strings.MAINPAGE_MENU_ABOUT}" >
<ShellContent ContentTemplate="{DataTemplate views:AboutShell }"/>
</Tab>
</TabBar>
这是我应用样式的标签栏:
当我点击更多按钮时:
我需要在这个更多按钮的屏幕上应用与我的 TabBar 上出现的相同的样式。
【问题讨论】:
标签: android ios xamarin.forms mobile xamarin.forms.shell