简体   繁体   English

Xamarin 表单 - 自定义 ContentPage 的工具栏项

[英]Xamarin forms - Customize ContentPage's toolbar item

I need to add a label inside a toolbar item in a ContentPage .我需要在ContentPage的工具栏项内添加一个标签。

I would like to create a CustomRenderer for iOS, Android and UWP, but I can't get the toolbar view for each platform.我想为 iOS、Android 和 UWP 创建一个CustomRenderer ,但我无法获得每个平台的工具栏视图。

For example, for Android I have tried to get the ActionBar and then add the label, but the ActionBar is always null.例如,对于Android,我尝试获取ActionBar然后添加标签,但ActionBar始终为空。

How can I create this CustomRenderer?如何创建此 CustomRenderer?

Thank you :D谢谢:D

Without using renderer:不使用渲染器:

<NavigationPage.TitleView>
  <label text="text"/>
</NavigationPage.TitleView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM