android - 当 ToolbarPlacement 位于底部且 ContentPage 计数大于 4 时,TabbedPage Toolbar 仅显示 Activity 的 ToolbarItem

标签 android xamarin xamarin.forms tabbedpage

在 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/

相关文章:

java - Android长字符串连接,

android - 如何在 android wear 应用程序中滑动 Activity ?

java - 错误: void cannot be dereferenced

c# - 显示灰色的推送通知图标

xamarin - 如何在 Xamarin 中的 ScrollView 内的 StackLayout 内正确使用 AbsoluteLayout?

android - 如何使用 adb 打开多个 Web 浏览器选项卡?

c# - 为一个 fragment 添加多个父 Activity

xamarin - MVVM 数据模型包含方法是一种好的做法吗?

mvvm - 在 ViewModel、Xamarin.Forms 中使用绑定(bind)在 StackLayout 中添加子项

c# - Xamarin.Forms 无法安装 Microsoft.Azure.Mobile.Client.SQLiteStore 2.1.1