简体   繁体   English

如何更改 Xamarin Forms 中标签页指示器的颜色

[英]How to change the color of tabbed page indicator in Xamarin Forms

I'm making an app using Xamarin Forms.我正在使用 Xamarin Forms 制作应用程序。 I have a tabbed page and wish to change the color of the tabbed indicator.我有一个选项卡式页面,并希望更改选项卡式指示器的颜色。 However I am unable to change it from the default of white.但是我无法将它从默认的白色更改。

A white indicator example:白色指示器示例:

白色指示器示例

I've tried changing the tabIndicatorColor in the Tabbar.xml file as shown below:我尝试更改 Tabbar.xml 文件中的 tabIndicatorColor,如下所示:

<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabIndicatorColor="@color/colourSelected"
app:tabGravity="fill"
app:tabMode="fixed" />

However this doesn't change it, no matter what color I use, the indicator will still be white.然而这并没有改变它,无论我使用什么颜色,指示器仍然是白色的。 How do I go about fixing this?我该如何解决这个问题?

Took me a while, but the problem seems to be a bug compiling with Android 10.0.花了我一段时间,但问题似乎是使用 Android 10.0 编译的错误。 Changing the "Compile using Android version" option to 9.0 from 10.0 in the android application screen fixed the problem.在 android 应用程序屏幕中将“使用 Android 版本编译”选项从 10.0 更改为 9.0 解决了问题。

After doing that, tabIndicatorColor works as intended.之后,tabIndicatorColor 按预期工作。

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

相关问题 如何在Xamarin.Droid中更改选项卡式页面指示器的颜色? - How to change color of tabbed page indicator in Xamarin.Droid? Xamarin Forms 更改标签页中的标签标题 - Xamarin Forms Change Tab Title in Tabbed Page 如何将FreshTabbedNavigationContainer选项卡式页面更改为顶部并更改Xamarin形式的ios的图标和字体大小 - How to change FreshTabbedNavigationContainer tabbed page to top and change icon and font size for ios in xamarin forms 如何更改原始选项卡页面栏的样式(android with xamarin.forms)? - How can I change style of the original tabbed page bar (android with xamarin.forms)? Xamarin.Forms - 如何导航到选项卡式页面子页面 - Xamarin.Forms - How to navigate to a tabbed page child page 如何提高标签页中的加载性能 xamarin forms - How to improve loading performance in Tabbed Page xamarin forms 如何在Xamarin.Forms中创建类似于Facebook应用程序的标签页 - How to create tabbed page in Xamarin.Forms similar to that of Facebook app 如何在xamarin.forms的选项卡式页面内添加用户控件 - How to add a user control inside a tabbed page in xamarin.forms 如何在Xamarin表单中使用滑块和页面指示器创建页面 - How to create page with slider and page indicator in xamarin forms Prism Xamarin表单选项卡式页面导航 - Prism Xamarin Forms Tabbed Page Navigation
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM