setImeOptions is not working when setting android:inputType="text" but when using android:inputType="textPassword" it is working?

436 views Asked by At

I have an EditText :

<EditText
                            android:id="@+id/vpa"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:background="@drawable/roundedcornerwhite"
                            android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.@"
                            android:hint="Enter UPI ID"
                            android:imeOptions="actionDone"
                            android:maxLines="1"
                            android:inputType="text"
                            android:paddingBottom="14dp"
                            android:paddingLeft="@dimen/padding_10dp"
                            android:paddingRight="@dimen/padding_10dp"
                            android:paddingTop="14dp"
                            android:textColor="@color/colorPrimaryText"
                            android:textColorHint="@color/hintcolor"
                            android:textCursorDrawable="@drawable/cursor"
                            android:textSize="@dimen/large_text_size" />

When I am setting the inputType as textPassword, the imeoptions is working though I cannot get the desired actionDone button. But when I am using inputtype text, imeoptions is not working in this case. What am I doing wrong?

1

There are 1 answers

0
newbieCoder.pkg On

The EditText in XML has a will of its own.

Do it programmatically and your problem is solved:

vpa.setImeOptions(EditorInfo.IME_ACTION_DONE);
vpa.setRawInputType(InputType.TYPE_CLASS_TEXT);