1
我是一種新的Android和有以下問題: 這裏是代碼:沒有重載方法SETERROR
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!");
}
};
};
當我構建它,它說這一點:對於method'SetError沒有超載」需要1個參數,什麼是錯誤的,因爲我有點困惑,並會出現錯誤信息?謝謝!
這是Xamarin嗎?你看過EditText.SetError的文檔嗎? – Tim
是的,它是Xamarin,是的,我已經從這裏閱讀關於seterror的文檔:http://developer.android.com/reference/android/widget/EditText.html –
根據Xamarin的文檔,「SetError」是從''Android.Widget.TextView.SetError',並且有兩個重載,它們都有兩個參數,不是一個:'SetError(Java.Lang.ICharSequence,Android.Graphics.Drawables.Drawable)'和'SetError(string, Android.Graphics.Drawables.Drawable)'。 – Tim