5

내 응용 프로그램에서 힌트를 레이블 효과가 필요한 모든 EditTexts 주위에 디자인 지원 라이브러리의 TextInputLayout을 사용합니다. 그러나 패스워드 필드에 적용하면 setError 메소드가 두 개의 느낌표를 적용하게됩니다. 하나는 EditText의 중간에, 다른 하나는 적절한 위치에, "눈"(패스워드 가시성)을 약간 덮는 것입니다. 상.EditText의 두 번째 느낌표 암호 유형 필드에서 사용할 때 setError

enter image description here

에만 textPassword로 설정 inputType이 필드를 발생합니다.

어떻게 해결할 수 있습니까?

편집 :

XML 레이아웃 단지 TextInputLayout 대한 오류 메시지를 설정하고 EDITTEXT 개체에서 제거

<android.support.design.widget.TextInputLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <EditText 
     android:id="@+id/loginEmail" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="@string/hint_email" 
     android:inputType="textEmailAddress"/>    
</android.support.design.widget.TextInputLayout> 

<android.support.design.widget.TextInputLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <EditText 
     android:id="@+id/loginPassword" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="@string/hint_password" 
     android:inputType="textPassword"/> 
</android.support.design.widget.TextInputLayout> 
+0

xml 코드를 게시하십시오. –

+0

레이아웃 코드가 추가되었습니다! – fonix232

+0

http://code.tutsplus.com/tutorials/creating-a-login-screen-using-textinputlayout--cms-24168 –

답변

8

시도.

+0

감사! 그것은 지금 완벽하게 작동합니다 :) – fonix232

+0

당신은 매우 환영합니다 :) –

+0

그러나 이것은 오류 표시의 성격을 변경합니다. textinputlayout에 set error를 사용하여 마지막에 플로팅 레이블을 사용할 수 없습니까? –