删除android版xamarin表单中物料输入控件的下划线

删除android版xamarin表单中物料输入控件的下划线,android,xaml,xamarin,xamarin.forms,material-design,Android,Xaml,Xamarin,Xamarin.forms,Material Design,我需要删除Xamarin.Forms for Android中材质输入控件的下划线 我使用的是Xamarin.Forms版本4.8.0.1687,在之前的Xamarin.Forms版本4.6.0.847中,我使用下一行隐藏材质条目下划线。现在,对于4.8.0.1687,它不起作用 Control.EditText.Background = null; Control.EditText.SetBackgroundColor(Android.Graphics.Color.Transparent);

我需要删除Xamarin.Forms for Android中材质输入控件的下划线

我使用的是Xamarin.Forms版本4.8.0.1687,在之前的Xamarin.Forms版本4.6.0.847中,我使用下一行隐藏材质条目下划线。现在,对于4.8.0.1687,它不起作用

Control.EditText.Background = null;
Control.EditText.SetBackgroundColor(Android.Graphics.Color.Transparent);
删除android版xamarin表单中物料输入控件的下划线

您好,自定义渲染器的类型是什么?如果使用物料
条目
,则类型应为
MaterialEntryRenderer

我用4.8.0.1687版测试了一个基本的演示程序来测试这个功能,效果很好。以下是相关代码:

[assembly : ExportRenderer(typeof(CustomEntry),typeof(CustomEntryRenderer))]
namespace TestApplication_1.Droid
{
    public class CustomEntryRenderer : MaterialEntryRenderer
    {
        public CustomEntryRenderer(Context context) : base(context) { }

        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);

            if (Control != null)
            {
                Control.EditText.Background = null;
                Control.EditText.SetBackgroundColor(Android.Graphics.Color.Transparent);
            }
        }
    }
}
[程序集:ExportRenderer(typeof(CustomEntry)、typeof(CustomEntryRenderer))]
命名空间TestApplication_1.Droid
{
公共类CustomEntryRenderer:MaterialEntryRenderer
{
公共CustomEntryRenderer(上下文):基本(上下文){}
受保护的覆盖无效OnElementChanged(ElementChangedEventArgs e)
{
基础。一个要素发生变化(e);
if(控件!=null)
{
Control.EditText.Background=null;
Control.EditText.SetBackgroundColor(Android.Graphics.Color.Transparent);
}
}
}
}
这是工作gif:

公共类BorderlessEntryRenderer:MaterialEntryRenderer
{
公共BorderReducerRenderer(上下文):基础(上下文)
{
}
受保护的覆盖无效OnElementChanged(ElementChangedEventArgs e)
{
基础。一个要素发生变化(e);
if(例如NewElement!=null)
{
SetBackgroundTintList(Control.EditText、ColorStateList.ValueOf(Android.Graphics.Color.Transparent));
}
}
}

您的目标是哪个android版本?目标是版本10并使用android 9设备进行检查。@开发人员尝试下面添加的问题的答案:如何将屏幕记录为gif?我尝试了emulator中包含的一个,但它在某些页面转换期间以1080x1920的分辨率记录了一个黑屏。它比真实的更快。我使用licecap工具进行屏幕截图,你可以试一试。谢谢,我会试一试的。
public class BorderlessEntryRenderer : MaterialEntryRenderer
{
    public BorderlessEntryRenderer(Context context) : base(context)
    {
    }

    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);

        if (e.NewElement != null)
        {
            ViewCompat.SetBackgroundTintList(Control.EditText,ColorStateList.ValueOf(Android.Graphics.Color.Transparent));
        }
    }
}