문제

I have an EditText that accepts a password. The functionality works great, except that a user set the password to 12 characters. For some reason, the EditText only allows 8 and no more.

Below is the EditText XML:

<EditText
        android:id="@+id/editTextPasswordValue"
        android:inputType="textPassword"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="25dp" 
        android:minEms="12" 
        android:singleLine="true"
        android:maxLength="12"   >
</EditText>

Thanks in advance

도움이 되었습니까?

해결책

Here is an example. I limit the size explicitely with the maxLength attribute, limit it to a single line with maxLines.

    <TextView 
    android:id="@+id/secondLineTextView" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:maxLines="1" 
    android:maxLength="10"/>

Just replace the value for android:maxLength="10"

다른 팁

I have just tested your EditText, its working fine. I am able to enter upto 12 characters..

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top