android 工具栏位置,Android 上的 TabbedPage 工具栏位置和颜色

Android 上的 TabbedPage 工具栏位置和颜色TabbedPage Toolbar Placement and Color on Android

07/10/2018

本文内容

重要

The platform-specifics that set the color of the toolbar on a TabbedPage are now obsolete and have been replaced by the SelectedTabColor and UnselectedTabColor properties. For more information, see Create a TabbedPage.

这些特定于平台的用于设置上工具栏的位置和颜色 TabbedPage 。These platform-specifics are used to set the placement and color of the toolbar on a TabbedPage. They are consumed in XAML by setting the TabbedPage.ToolbarPlacement attached property to a value of the ToolbarPlacement enumeration, and the TabbedPage.BarItemColor and TabbedPage.BarSelectedItemColor attached properties to a Color:

xmlns:android="clr-namespace::::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific;assembly=:::no-loc(Xamarin.Forms):::.Core"

android:TabbedPage.ToolbarPlacement="Bottom"

android:TabbedPage.BarItemColor="Black"

android:TabbedPage.BarSelectedItemColor="Red">

...

或者,可以使用 Fluent API 从 c # 中使用:Alternatively, they can be consumed from C# using the fluent API:

using :::no-loc(Xamarin.Forms):::.PlatformConfiguration;

using :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific;

...

On().SetToolbarPlacement(ToolbarPlacement.Bottom)

.SetBarItemColor(Color.Black)

.SetBarSelectedItemColor(Color.Red);

TabbedPage.On方法指定这些平台细节仅在 Android 上运行。The TabbedPage.On method specifies that these platform-specifics will only run on Android. [ TabbedPage.SetToolbarPlacement ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. TabbedPage. SetToolbarPlacement (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。TabbedPage}, :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. ToolbarPlacement) # A3 方法(位于 :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific 命名空间中)用于设置上的工具栏位置 TabbedPage , ToolbarPlacement 枚举提供以下值:The TabbedPage.SetToolbarPlacement method, in the :::no-loc(Xamarin.Forms):::.PlatformConfiguration.AndroidSpecific namespace, is used to set the toolbar placement on a TabbedPage, with the ToolbarPlacement enumeration providing the following values:

Default -指示将工具栏放置在页面上的默认位置。Default – indicates that the toolbar is placed at the default location on the page. 这是在手机上页面的顶部,而在其他设备上页面的底部惯例。This is the top of the page on phones, and the bottom of the page on other device idioms.

Top -指示将工具栏置于页面顶部。Top – indicates that the toolbar is placed at the top of the page.

Bottom -指示将工具栏置于页面的底部。Bottom – indicates that the toolbar is placed at the bottom of the page.

此外,[ TabbedPage.SetBarItemColor ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. TabbedPage. SetBarItemColor (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。TabbedPage}, :::no-loc(Xamarin.Forms)::: 。颜色) # A3 和 [ TabbedPage.SetBarSelectedItemColor ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. TabbedPage. SetBarSelectedItemColor (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。TabbedPage}, :::no-loc(Xamarin.Forms)::: 。颜色) # A7 方法用于分别设置工具栏项和所选工具栏项的颜色。In addition, the TabbedPage.SetBarItemColor and TabbedPage.SetBarSelectedItemColor methods are used to set the color of toolbar items and selected toolbar items, respectively.

备注

[ GetToolbarPlacement ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. TabbedPage. GetToolbarPlacement (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。TabbedPage} ) # A3,[ GetBarItemColor ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. TabbedPage. GetBarItemColor (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。TabbedPage} ) # A7,[ GetBarSelectedItemColor ] (x: :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration. AndroidSpecific. TabbedPage. GetBarSelectedItemColor (:::no-loc(Xamarin.Forms)::: 。IPlatformElementConfiguration { :::no-loc(Xamarin.Forms)::: 。PlatformConfiguration :::no-loc(Xamarin.Forms)::: 。TabbedPage} ) # A11 方法可用于检索工具栏的位置和颜色 TabbedPage 。The GetToolbarPlacement, GetBarItemColor, and GetBarSelectedItemColor methods can be used to retrieve the placement and color of the TabbedPage toolbar.

结果是工具栏的位置、工具栏项的颜色以及所选工具栏项的颜色可以在上设置 TabbedPage :The result is that the toolbar placement, the color of toolbar items, and the color of the selected toolbar item can be set on a TabbedPage:

19f79f192e0e197ecff373f380898125.png

相关链接Related links

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值