[英]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.