我是 Xamarin-Forms 的新手,正在开发登录表单并使用 Material Design (IVisual
)。我创建了一个自定义 Entry 类并继承它MaterialEntryRenderer
来定制它。
我想要实现的目标是删除下划线Entry
有。我看过很多例子,但它们都使用EntryRenderer
反而。
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);
}
}
}
它工作得很好EntryRenderer
但不是为了MaterialEntryRenderer
.
试试这个,它对我有用
Control.EditText.Background = null;
Control.EditText.SetBackgroundColor(Android.Graphics.Color.Transparent);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)