【问题标题】:Xamarin Forms - Change cursor colour and bottom border using XAMLXamarin Forms - 使用 XAML 更改光标颜色和底部边框
【发布时间】:2017-12-11 20:54:22
【问题描述】:

我想使用 XAML 更改光标的颜色和 Entry 字段的底部边框。 (目前它是粉红色的)。更改字体颜色没有帮助,我也看不到 IntelliSense 中的任何信息。有人可以告诉我如何在 XAML 中执行此操作吗?谢谢你。

<Entry
    x:Name="editorEmailAddress"
    TextColor="Purple" />

在 Android 中,它显示为粉红色。

【问题讨论】:

  • 你不能。您必须编辑资源文件
  • @Alex 你的意思是 Xamarin.Android 项目中的 styles.xml 文件吗?如果无法使用 XAML,您能告诉我该怎么做吗?

标签: c# xamarin.forms


【解决方案1】:

更改 styles.xml(在 Xamarin.Android 项目中)中的 colorAccent 值将更改光标的颜色和 Entry 的底部边框字段。

<item name="colorAccent">#BA55D3</item>

【讨论】:

  • 我在 Xamarin Forms 4.7 中使用了 #800080 来完成此操作。
【解决方案2】:

https://developer.xamarin.com/guides/android/user_interface/material_theme/

按照指南解决您的问题。

或者如果您想通过自定义渲染更改它,请点击以下链接。

Is it possible to change the colour of the line below / Border of a TextBox (Entry)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-12
    • 2012-08-08
    相关资源
    最近更新 更多