Frage

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

War es hilfreich?

Lösung

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"

Andere Tipps

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top