在 Xamarin 表单中使用 MaterialEntryRenderer Placeholdercolor 和 Cursorcolor 未更改 Ios
Using MaterialEntryRenderer Placeholdercolor and Cursorcolor not Changed in Xamarin forms Ios
如何在 ios 渲染器中更改占位符颜色和光标颜色?我已经更改了占位符中的 TintColor 属性 和 Control.AttributedPlaceholder 中的光标颜色,它没有更改 ios
中的占位符颜色和光标颜色
public class CustomMaterialEntryRenderer:MaterialEntryRenderer
{
}
这里不用MaterialEntryRenderer
.
只需在 Forms 项目中设置 PlaceholderColor
,它会更改占位符和光标颜色。
<Entry Placeholder="test" Visual="Material" Focused="Entry_Focused" Unfocused="Entry_Unfocused"/>
private void Entry_Focused(object sender, FocusEventArgs e)
{
var entry = sender as Entry;
entry.PlaceholderColor = Color.Red;
}
private void Entry_Unfocused(object sender, FocusEventArgs e)
{
var entry = sender as Entry;
entry.PlaceholderColor = Color.Gray;
}
如何在 ios 渲染器中更改占位符颜色和光标颜色?我已经更改了占位符中的 TintColor 属性 和 Control.AttributedPlaceholder 中的光标颜色,它没有更改 ios
中的占位符颜色和光标颜色public class CustomMaterialEntryRenderer:MaterialEntryRenderer {
}
这里不用MaterialEntryRenderer
.
只需在 Forms 项目中设置 PlaceholderColor
,它会更改占位符和光标颜色。
<Entry Placeholder="test" Visual="Material" Focused="Entry_Focused" Unfocused="Entry_Unfocused"/>
private void Entry_Focused(object sender, FocusEventArgs e)
{
var entry = sender as Entry;
entry.PlaceholderColor = Color.Red;
}
private void Entry_Unfocused(object sender, FocusEventArgs e)
{
var entry = sender as Entry;
entry.PlaceholderColor = Color.Gray;
}