ontentPage计数大于4时显示活动的ToolbarItem

ontentPage计数大于4时显示活动的ToolbarItem

本文介绍了TabbedPage工具栏仅在ToolbarPlacement位于底部且ContentPage计数大于4时显示活动的ToolbarItem.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xamarin.Forms 3.1版本中有一个功能,我们已经支持将Android工具栏放置在底部.但是,当选项卡式页面"中的内容页面大于4时,工具栏将不会在其中显示所有选项卡,而只会显示当前活动的选项卡. 其他选项只能切换,然后相应地选择选项卡.这是我的代码,工具栏中应该有四个选项卡:

There is a feature in Xamarin.Forms 3.1 version which we already support for Android toolbar to be placed in the bottom. But when the content page within the Tabbed Page is bigger than 4, then the Toolbar will no show all the tabs there, only the current active tab will be showed. the other ones can be only switched and then the tab will be selected accordingly.this is my code, There should be four tabs in the toolbar :

<?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

我需要显示所有页面标题.我该怎么办?

I need to show all page titles. what should I do for this problem?

推荐答案

这是底部标签栏的一个已知问题,当有3个以上的项目时android将激活shift模式.您可以执行自定义渲染来解决此问题.

Hi this is a known issue with bottom tab bar when there are more than 3 items android will activate shift mode.You can do a custom render to fix this issue.

从此处将粘贴代码复制到您的项目中,以实现自定义渲染以关闭移位模式 https://gist.github.com/LynoDesu/64904b6d143892cf14a60a32798a36bb

Copy paste code from here to your project to implement custom render to turn shift mode offhttps://gist.github.com/LynoDesu/64904b6d143892cf14a60a32798a36bb

这篇关于TabbedPage工具栏仅在ToolbarPlacement位于底部且ContentPage计数大于4时显示活动的ToolbarItem.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 23:03