1

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

  • Try removing `android:minEms="12"` and test whether it solves it. – nKn Feb 14 '14 at 18:33
  • also the `maxLength` might be an issue. but the xml says about 12 chars. why do you mention 8? – cosmincalistru Feb 14 '14 at 18:36
  • have you already tried the suggested solutions here: http://stackoverflow.com/questions/3285412/limit-text-length-of-edittext-in-android – donfuxx Feb 14 '14 at 18:37
  • remove the android:minEms="12" – Ashok Singhal Feb 14 '14 at 18:37
  • Probably not, but just to make sure: Wouldn't be the problem that your `EditText` accepts 12 characters in fact but as it's size limited (probably to 8 chars visually) and you see just `*`s, you think it's just 8? :-) Have you tried actually getting its value and seeing if it's really 8 max? – nKn Feb 14 '14 at 18:42

2 Answers2

1

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"

T.V.
  • 793
  • 12
  • 33
0

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

A.R.
  • 2,631
  • 1
  • 19
  • 22