1

私はAndroidの初心者で、次の問題があります:コードは次のとおりです:

 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!");
                        }
                    };
            };

私がそれをビルドすると、次のように表示されます: メソッド 'SetError' のオーバーロードは 1 つの引数を取ります。何が問題なのですか? どうも!

4

1 に答える 1

1

エラーメッセージとともに表示されるようにドローアブルを設定する必要があります。これは 2 つの引数を取り、2 つ目はメッセージと共に表示されるアイコンである Drawable です。

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 );
                        }
于 2014-08-15T17:17:55.413 に答える