Randroid Randroid - 18 days ago 5
Android Question

android: singleline = true not working for edittext

I want to restrict the edittext entry to a single line but When I add the line

android:singleline = "true"
, the hint is disappears, and after entering 26 characters the cursor is coming down.

Here's my XML code:

<EditText
android:background="@drawable/edittxtborder"
android:id="@+id/reglastname"
android:singleLine="true"
android:gravity="center"
android:hint="@string/reglname"
android:textSize="12dp"
/>

Answer

add this code in your edittext xml code.

android:ellipsize="end"

this will work.

Comments