Xamarin Forms - 使用XAML更改光标颜色和底部边框

问题描述:

我想使用XAML更改光标的颜色和Entry字段的底部边框。 (此刻它是粉红色的)。改变字体颜色并没有帮助,我也无法在IntelliSense中看到任何信息。有人可以告诉我如何在XAML中做到这一点?谢谢。Xamarin Forms - 使用XAML更改光标颜色和底部边框

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

在Android中,它显示为粉红色。 enter image description here

+0

你不能。你必须编辑资源文件 – Alex

+0

@Alex你的意思是Xamarin.Android项目中的styles.xml文件?如果无法使用XAML,请告诉我该怎么做? – Curiousity

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

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

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)