如何解决集中精力时,从Xamarin形式的ios的材质输入控件中删除下划线
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms.Material.iOS;
using MyApp.iOS;
using MyApp;
using UIKit;
using System.ComponentModel;
[assembly: ExportRenderer(typeof(CustomMaterialEntry),typeof(CustomMaterialEntryRenderer),new[] { typeof(VisualMarker.MaterialVisual) })]
namespace MyApp.iOS
{
public class CustomMaterialEntryRenderer : MaterialEntryRenderer
{
/// <summary>
/// Element Changed Event
/// </summary>
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (this.Control != null)
{
UITextField UpdatedEntry = (UITextField)Control;
UpdatedEntry.Background = null;
UpdatedEntry.BackgroundColor = UIColor.Clear;
}
}
protected override void OnElementPropertyChanged(object sender,PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender,e);
if (this.Control != null)
this.Control.Underline.Color = UIColor.Clear;
}
}
}
对于android,它可以工作,但是当专注于ios中的材料输入时,它会显示带下划线。请帮助我删除xamarin.forms的ios中的下划线
解决方法
尝试将有效的下划线高度设置为0f
:
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (this.Control != null)
{
Control.ActiveTextInputController.UnderlineHeightActive = 0f;
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。