3

I have a question about EditText.setError().

I have an 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"/>

I want to display the error message "please enter a valid security code" using the setError() method.

When I run the app I'm getting an error displayed in multiple lines as shown in the picture

security code Edit text

What would I do to display this error in single line?

alex.p
  • 2,627
  • 17
  • 28
hemanth kumar
  • 3,068
  • 10
  • 41
  • 64
  • final EditText cardSCNoField = (EditText) findViewById(R.id.credit); String cardSCNoString = cardSCNoField.getText().toString().trim(); cardSCNoField.setError("The Security code no is not valid please enter a valid code."); – hemanth kumar Aug 03 '11 at 10:12
  • 1
    give some width to edittext and it will display correctly like fill_parent – ingsaurabh Aug 03 '11 at 10:34

1 Answers1

1

Try android:scrollHorizontally="true".

EDIT: Use android:SingleLine="true".

jenzz
  • 7,239
  • 6
  • 49
  • 69
Hanry
  • 5,481
  • 2
  • 40
  • 53