2011-08-03 10 views
3

나는 EditText.setError()에 대한 질문이 있습니다.한 줄에 EditText.setError()

<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() 방법을 사용하여 을 할 :

가 나는 글고 있습니다.

내가 사진

security code Edit text

내가 한 줄이 오류를 표시하기 위해 무엇을 할 것 같이 내가 여러 줄에 표시되는 오류가있어 응용 프로그램을 실행하면?

+1

seterror 코드를 표시 하시겠습니까? –

+0

마지막 EditText cardSCNoField = (EditText) findViewById (R.id.credit); String cardSCNoString = cardSCNoField.getText(). toString(). trim(); cardSCNoField.setError ("보안 코드가 유효하지 않습니다. 올바른 코드를 입력하십시오."); –

+1

edittext에 약간의 폭을 지정하면 fill_parent와 같이 올바르게 표시됩니다. – ingsaurabh

답변

1

시도 android:scrollHorizontally="true".

편집 : android:SingleLine="true"을 사용하십시오.

+0

시도했지만 작동하지 않았습니다. –

+0

@hemanth kumar 답변을 수정했습니다. – Hanry

+0

여러분도 알다시피, singleLine은 더 이상 사용되지 않습니다. – Otra

관련 문제