C# 方法SetError没有重载
我是android新手,有以下问题: 代码如下:C# 方法SetError没有重载,c#,android,visual-studio-2012,C#,Android,Visual Studio 2012,我是android新手,有以下问题: 代码如下: base.OnCreate(bundle); var layout = FindViewById<LinearLayout>(Resource.Id.layout1); Button butondata = FindViewById<Button>(Resource.Id.button3); Button butonstartdate = FindViewById<B
base.OnCreate(bundle);
var layout = FindViewById<LinearLayout>(Resource.Id.layout1);
Button butondata = FindViewById<Button>(Resource.Id.button3);
Button butonstartdate = FindViewById<Button>(Resource.Id.button4);
Button butonenddate = FindViewById<Button>(Resource.Id.button5);
EditText txtsubiect = FindViewById<EditText>(Resource.Id.editText1);
Button submit = FindViewById<Button>(Resource.Id.buttonsalveaza);
butondata.Click += butondata_Click;
submit.Click += (sender, e) =>
{
txtsubiect.TextChanged += (object sender1, Android.Text.TextChangedEventArgs f) =>
{
if (txtsubiect.Text.Length <= 0)
{
txtsubiect.RequestFocus();
txtsubiect.SetError("Eroare,camp gol!");
}
};
};
base.OnCreate(bundle);
var layout=findviewbyd(Resource.Id.layout1);
Button butondata=FindViewById(Resource.Id.button3);
Button ButtonStartDate=FindViewById(Resource.Id.button4);
Button ButonedDate=FindViewById(Resource.Id.button5);
EditText-txtsubiect=findviewbyd(Resource.Id.editText1);
Button submit=FindViewById(Resource.Id.buttonsalveaza);
butondata.Click+=butondata\u Click;
提交。单击+=(发件人,e)=>
{
txtsubiect.TextChanged+=(对象发送者1,Android.Text.textchangedventargs f)=>
{
如果(txtsubiect.Text.Length,则需要设置一个可绘制的,与错误消息一起显示。
它有两个参数,第二个是一个可绘制的图标,与消息一起显示
Drawable icon_error = Resources.GetDrawable(Resource.Drawable.icon_error);//this should be your error image.
icon_error.SetBounds(0,0,icon_error.IntrinsicWidth,icon_error.IntrinsicHeight);
if (txtsubiect.Text.Length <= 0)
{
txtsubiect.RequestFocus();
txtsubiect.SetError("Eroare,camp gol!", icon_error );
}
Drawable icon\u error=Resources.GetDrawable(Resource.Drawable.icon\u error);//这应该是您的错误图像。
图标错误.SetBounds(0,0,图标错误.IntrinsicWidth,图标错误.IntrinsicHeight);
如果(txtsubiect.Text.Length,则需要设置一个可绘制的,与错误消息一起显示。
它有两个参数,第二个是一个可绘制的图标,与消息一起显示
Drawable icon_error = Resources.GetDrawable(Resource.Drawable.icon_error);//this should be your error image.
icon_error.SetBounds(0,0,icon_error.IntrinsicWidth,icon_error.IntrinsicHeight);
if (txtsubiect.Text.Length <= 0)
{
txtsubiect.RequestFocus();
txtsubiect.SetError("Eroare,camp gol!", icon_error );
}
Drawable icon\u error=Resources.GetDrawable(Resource.Drawable.icon\u error);//这应该是您的错误图像。
图标错误.SetBounds(0,0,图标错误.IntrinsicWidth,图标错误.IntrinsicHeight);
如果(txtsubiect.Text.Length这是Xamarin吗?你看过EditText.SetError的文档了吗?是的,这是Xamarin,是的,我从这里读过关于SetError的文档:根据Xamarin的文档,SetError
是从Android.Widget.TextView.SetError
继承的,有两个重载,它们都需要两个参数,不是一个:SetError(Java.Lang.ICharSequence,Android.Graphics.Drawables.Drawable)
和SetError(string,Android.Graphics.Drawables.Drawable)
-您需要向下滚动列表以查看SetError
的两个重载。我明白了,好的,我会试试看,thx:)这是Xamarin吗?你看过EditText.SetError的文档了吗?是的,它是Xamarin,是的,我从这里读过关于SetError的文档:根据Xamarin的文档,SetError
是从Android.Widget.TextView.SetError
继承的,有两个重载,它们都有两个参数,而不是一个:SetError(Java.Lang.ICharSequence,Android.Graphics.Drawables.Drawable)
和SetError(string,Android.Graphics.Drawables.Drawable)
-您需要向下滚动列表以查看SetError
的两个重载。我明白了,好的,我会尝试一下,thx:)thx用于答案:)thx用于答案:)