[英]How to change SelectedTabColor and UnselectedTabColor in Xamarin.Forms ( BottomBarPage )
How to change SelectedTabColor and UnselectedTabColor in Xamarin.Forms ( BottomBarPage ) - My BottomBarPage XML is the following如何更改 Xamarin.Forms ( BottomBarPage ) 中的 SelectedTabColor 和 UnselectedTabColor —— 我的 BottomBarPage XML 如下
<?xml version="1.0" encoding="UTF-8"?>
<xf:BottomBarPage
xmlns:xf="clr-namespace:BottomBar.XamarinForms; assembly=BottomBar.XamarinForms"
xmlns:local="clr-namespace:ECommerce.Views"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ECommerce.Views.MainMenu"
BarBackgroundColor="White"
BarTextColor="#FF64AA"
SelectedTabColor="#FF64AA" UnselectedTabColor="Black"
NavigationPage.HasNavigationBar="False">
...
It works in ios however not in android, help me please它适用于 ios 但不适用于 android,请帮帮我
The plugin has not been updated for a long time (more than 2 years).插件很久没有更新了(2年多)。 If you want to let the tabbed display in bottom of the screen, you just need to use the default TabbedPage and set the value of ToolbarPlacement .
如果你想让标签页显示在屏幕底部,你只需要使用默认的TabbedPage并设置ToolbarPlacement的值。
<TabbedPage ...
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:TabbedPage.ToolbarPlacement="Bottom"
BarBackgroundColor="White"
SelectedTabColor="#FF64AA" UnselectedTabColor="Black"
...>
If it still doesn't work,add the following lines in xaml如果还是不行,在 xaml 中添加以下几行
android:TabbedPage.BarItemColor="Black"
android:TabbedPage.BarSelectedItemColor="#FF64AA"
Simply Use TabbedPage with Android Specific Platform Configuration for Toolbar(Tab Bar) Placement on Android:只需将 TabbedPage 与 Android 特定平台配置一起使用,即可在 Android 上放置工具栏(Tab Bar):
<TabbedPage 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"
android:TabbedPage.ToolbarPlacement="Bottom"
x:Class="Test.MyTabbedPage"
BarBackgroundColor="White"
BarTextColor="#FF64AA"
SelectedTabColor="#FF64AA"
UnselectedTabColor="Black"
NavigationPage.HasNavigationBar="False">
This could help you这可以帮助你
<xf:BottomBarPage.ToolbarItems x:BackgroundColor="#D60000"> <ToolbarItem Name="User" Order="Primary" Icon="home.png" Text="Item 1" Priority="0" Clicked="User_Clicked"/> </xf:BottomBarPage.ToolbarItems> <xf:BottomBarPage.Children> <Views:MainPage ClassId="Home" Title="Page1" Icon="Page1.png" xf:BottomBarPageExtensions.TabColor="#D60000"/> <Views:MainPage Title="Page2" Icon="Page2.png" xf:BottomBarPageExtensions.TabColor="#D60000"/> <Views:Graphs Title="Page3" Icon="Page3.png" xf:BottomBarPageExtensions.TabColor="#D60000"/> <Views:MainPage Title="Page4" Icon="Page4.png" xf:BottomBarPageExtensions.TabColor="#D60000"/> <Views:Info Title="Page5" Icon="Page5.png" xf:BottomBarPageExtensions.TabColor="#D60000"/> </xf:BottomBarPage.Children>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.