【问题标题】:Add more tabs in Xamarin forms TabbedPage在 Xamarin 表单 TabbedPage 中添加更多选项卡
【发布时间】:2020-12-14 10:27:45
【问题描述】:

我有一个要求,比如在 TabbedPage 中添加更多选项卡。最初它的数量是 5 个并且工作正常。当我添加一个更多选项卡(比如第 6 个)时,应用程序的 android 版本正在触发 'illegalArgumentException'

IOS 版本没有触发任何错误,而是将选项卡从第 5 个位置加载到外观不太好的新列表视图。

感谢任何解决方案。

【问题讨论】:

  • 你的 XF 版本是多少?我无法在我的项目中重现您的问题。
  • 版本是 - 3.6
  • 您可以尝试将 XF 版本更新到最新版本。

标签: xamarin xamarin.forms tabbedpage


【解决方案1】:

使用按钮和图标字体代替 tabbedPage 怎么样? 您可以显示按钮 6 或更多。

xaml

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
<!-- Put contents here -->
    <StackLayout Grid.Row="0"
                Orientation="Horizontal" HorizontalOptions="FillAndExpand" VerticalOptions="End"
                          >
        <Button FontFamily="{DynamicResource MaterialFontFamily}"
        Text="&#xF1514;" FontSize="Large" TextColor="Blue"
                HorizontalOptions="CenterAndExpand" BackgroundColor="Transparent" />
        <Button FontFamily="{DynamicResource MaterialFontFamily}"
        Text="&#xF1513;" FontSize="Large" TextColor="Blue"
                HorizontalOptions="CenterAndExpand" BackgroundColor="Transparent" />
                    <Button FontFamily="{DynamicResource MaterialFontFamily}"
        Text="&#xF1512;" FontSize="Large" TextColor="Blue"
                HorizontalOptions="CenterAndExpand" BackgroundColor="Transparent" />
                    <Button FontFamily="{DynamicResource MaterialFontFamily}"
        Text="&#xF1511;" FontSize="Large" TextColor="Blue"
                HorizontalOptions="CenterAndExpand" BackgroundColor="Transparent" />
        <Button FontFamily="{StaticResource MaterialFontFamily}"
                Text="&#xF158C;" FontSize="Large" TextColor="Blue"
         HorizontalOptions="CenterAndExpand" BackgroundColor="Transparent" />
        <Button FontFamily="{DynamicResource MaterialFontFamily}"
        Text="&#xF1543;" FontSize="Large" TextColor="Blue"
                HorizontalOptions="CenterAndExpand" BackgroundColor="Transparent"/>
    </StackLayout>
</Grid>

【讨论】:

  • 感谢您的回复。似乎这会起作用,但我正在标签页上寻求任何解决方案,因为实施已经完成,我不想改变现有流程。
猜你喜欢
  • 1970-01-01
  • 2022-01-08
  • 1970-01-01
  • 1970-01-01
  • 2018-01-07
  • 2020-05-21
  • 2019-03-20
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多