xamarin - Remove underline from Entry Control in Xamarin Forms
问题描述
I am new to Xamarin-Forms and developing a login form and using Material Design (IVisual
). I have created a custom Entry class and inherited it with MaterialEntryRenderer
to customize it.
Thing i want to achieve is to remove underline Entry
have. I have see alot of examples but all of them use EntryRenderer
instead.
public class CustomEntryRenderer : MaterialEntryRenderer
{
public CustomEntryRenderer(Context context) : base(context) { }
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.Background = null;
Control.SetBackgroundColor(Android.Graphics.Color.Transparent);
}
}
}
it work fine with EntryRenderer
but not for MaterialEntryRenderer
.
解决方案
试试这个,它对我有用
Control.EditText.Background = null;
Control.EditText.SetBackgroundColor(Android.Graphics.Color.Transparent);
推荐阅读
- docker - 使用 docker-compose 和自定义 Dockerfile 挂载目录为空
- react-native - 列表项的背景颜色不起作用?
- html - 图片未显示在 div 中
- r - 使用 Rcpp 公开 C 结构?
- flutter - 无法在 Appbar 操作小部件 onPress 触发器内显示快餐栏
- android - launchBillingFlow() 无法显示 Google Play 购买屏幕
- javascript - 使用 JS replace() 方法替换 HTML 实体
- c# - 将 UWP DataGrid 绑定到 MVVM 模型的困惑
- angular - 如何在 Angular 7 中创建博客类别
- java - Java - 数据结构设计 - 固定大小、随机访问、线程安全、有序集合