【问题标题】:How to change the color of tabbed page indicator in Xamarin Forms如何在 Xamarin Forms 中更改选项卡式页面指示器的颜色
【发布时间】:2021-03-27 05:11:07
【问题描述】:

我正在使用 Xamarin Forms 制作应用程序。我有一个选项卡式页面,并希望更改选项卡式指示器的颜色。但是我无法将其从默认的白色更改。

一个白色指示器示例:

我已尝试更改 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" />

但这并没有改变它,无论我使用什么颜色,指示器仍然是白色的。我该如何解决这个问题?

【问题讨论】:

  • 直接用十六进制代码试试app:tabIndicatorColor="#FF9F11"
  • 我试过了,还是没有变化
  • 不,我使用的是 TabbedPage。将 android 编译版本从 10.0 更改为 9.0 似乎可以解决问题

标签: c# xamarin xamarin.forms indicator tabbedpage


【解决方案1】:

花了我一段时间,但问题似乎是使用 Android 10.0 编译的错误。在 android 应用程序屏幕中将“使用 Android 版本编译”选项从 10.0 更改为 9.0 解决了该问题。

完成此操作后,tabIndicatorColor 按预期工作。

【讨论】:

  • 似乎是一个错误,你应该在 github 上提出它
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多