在 Xamarin.Forms 3.1 版本中我们已经支持将 Android 工具栏放置在底部的功能。但是当 Tabbed Page 中的内容页大于 4 时,Toolbar 将不会显示那里的所有选项卡,只会显示当前 Activity 的选项卡。 其他的只能切换,然后相应地选择选项卡。 这是我的代码,工具栏中应该有四个选项卡:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage
x:Class="MelkRadar.App.MobileApp.Views.TabbedView"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
xmlns:view="clr-namespace:MelkRadar.App.MobileApp.Views"
android:TabbedPage.ToolbarPlacement="Bottom"
BarTextColor="Red">
<view:CustomerExplorerView Title="مشتریان" />
<view:RealtorSettingView Title="تنظیمات" />
<view:FavoriteAdvertsExplorerView Title="زونکن" />
<view:AdvertsExplorerView Title="اگهی ها" />
</TabbedPage>
请看这张照片:
https://cdn1.imggmi.com/uploads/2019/6/11/6659fa76fc68ae58deb17d6dfd74f089-full.jpg https://cdn1.imggmi.com/uploads/2019/6/11/150fe2463357f9008da3bed6d976d1bd-full.jpg
我需要显示所有页面标题。这个问题我该怎么办?
最佳答案
您好,这是底部标签栏的一个已知问题,当有超过 3 个项目时,android 将激活 shift 模式。 您可以进行自定义渲染来解决此问题。
从此处复制粘贴代码到您的项目以实现自定义渲染以关闭 shift 模式 https://gist.github.com/LynoDesu/64904b6d143892cf14a60a32798a36bb
关于android - 当 ToolbarPlacement 位于底部且 ContentPage 计数大于 4 时,TabbedPage Toolbar 仅显示 Activity 的 ToolbarItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56543328/