【问题标题】:Customize Tabbed page for android in xamarin.forms在 xamarin.forms 中为 android 自定义标签页
【发布时间】:2019-05-13 03:27:18
【问题描述】:

我想为底部选项卡创建这种设计(更改 xamarin 表单中选项卡式页面的选定选项卡的背景颜色)

我想解决安卓上的问题。请帮帮我!谢谢。

【问题讨论】:

  • 您遇到了什么问题,到目前为止您尝试解决什么问题?请包含您的应用程序的minimal reproducible example(使用formatted text,请不要使用图片!)。除非我们首先知道问题所在,否则我们无法帮助您解决问题。
  • 谢谢!我想更改 android 上选定选项卡的背景颜色
  • 尝试使用TabbedPageRenderer处理。如果你想设置底栏,可以参考这个[链接][1]。有很多方法可以尝试。如果想改变背景颜色,你可以参考这个[链接][2]。
  • @JuniorJiang-MSFT:您的 linsk 在您的评论中损坏了。
  • 对不起,我找到了。你可以参考这个链接。(*.com/questions/49707608/…,你应该改变这个中的一些代码。需要android中的自定义页面xml。

标签: xamarin.forms renderer


【解决方案1】:

需要更多关于该问题的说明,如果您想像在 iOS 中一样将标签栏移到底部,下面的代码可以帮助您。

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
        x:Class="XXX.Views.TabbedPage" 
        xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
        android:TabbedPage.ToolbarPlacement="Bottom"
        android:TabbedPage.BarItemColor="#a39d9f"
        android:TabbedPage.BarSelectedItemColor="#007aff"
        android:TabbedPage.IsSwipePagingEnabled="false"
        BackgroundColor="#f8f8f8"
        Padding="5,0,5,0" >

</TabbedPage>

【讨论】:

  • 感谢您的评论。但这个解决方案不能解决我的问题。我想在 andorid 上更改标签页的选定标签的背景颜色。