私はEditText.setError()
について質問があります。1行のEditText.setError()
私はのEditTextを持っている:
<TextView android:id="@+id/sc_num"
style="@style/textLabel"
android:text="@string/scnum"
android:layout_below="@+id/creditCard"/>
<EditText android:id="@+id/credit"
android:background="@android:drawable/editbox_background"
android:layout_below="@+id/sc_num"
android:layout_alignRight="@+id/state"/>
私は、エラーメッセージ「有効なセキュリティコードを入力してください」setError()
方法を使用して を表示したいです。
写真のように私は、単一の行で、このエラーを表示するには、何をするだろう、私は複数行に表示されたエラーを取得していますアプリを実行しますか?
私たちにseterrorコードを表示しますか? –
最終編集テキストcardSCNoField =(EditText)findViewById(R.id.credit); String cardSCNoString = cardSCNoField.getText()。toString()。trim(); cardSCNoField.setError( "セキュリティコードは無効です。有効なコードを入力してください。"); –
edittextにいくらかの幅を与え、それはfill_parentのように正しく表示されます – ingsaurabh