xamarin - 在 Xamarin 表单 Ios 中使用 MaterialEntryRenderer Placeholdercolor 和 Cursorcolor 未更改
问题描述
如何在 ios 渲染器中更改占位符颜色和光标颜色?我已经更改了占位符中的 TintColor 属性和 Control.AttributedPlaceholder 中的光标颜色,它没有更改 ios 中的占位符颜色和光标颜色
公共类 CustomMaterialEntryRenderer : MaterialEntryRenderer {
}
解决方案
这里我们不需要使用MaterialEntryRenderer
.
只需PlaceholderColor
在 Forms 项目中设置,它就会改变占位符和光标颜色。
<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;
}
推荐阅读
- yaml - 使用值数组重复 GitHub Actions 工作流程中的步骤
- java - Kafka SpringBoot StreamListener - 如何按顺序消费多个主题?
- c# - 修改 lambda 表达式
> 到表达式 以 LINQ to Entities 安全方式 - c# - 给定一个类型,你如何确定它被装箱为什么类型?
- python - 其他列条件下 groupby 数据帧中的交换计数
- kubernetes - 如何使用请求标头作为 Traefik 入口控制器的入口点地址的路径变量
- matlab - 使用刚性变换拟合图像
- javascript - 发送包含脚本标签的 XMLHttpRequest
- javascript - JavaScript 中音频缓冲区的 HTML 文件输入
- powershell - Powershell 无法使用 Windows 资源管理器快捷方式打开