Here my edittext:-
<com.os.fastlap.util.customclass.EditTextPlayRegular
android:id="@+id/full_name_et"
style="@style/Edittext_white_13sp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/_5sdp"
android:background="#00ffffff"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
android:imeOptions="actionNext"
android:inputType="text"
android:maxLength="20"
android:maxLines="1"
android:nextFocusDown="@+id/last_name_et"
android:textCursorDrawable="@null" />
When I remove digit
in edittext it work fine but with digit
imeOptions
doesn't work. But one surprising thing if I use singleLine
instead of maxLines it work fine. But singleLine
now is deprecated. I cannot remove digit in my edittext and I don't want use deprecated method. Any one can solve this problem. Thanks in adavance
android:maxLines
only Makes the TextView be at most this many lines tall, not prevent user from input more characters.The same with
android:lines
that only makes the TextView be exactly this many lines tall.The problem is you are clicking on Enter key instead of the actionNext you need in order to move cursor to next EditText
It causes carriage return for your action button. So it means that doesn't fire
android:nextFocusDown
First of all, lets see what is difference between singleLine which is deprecated and maxLines
singleLine
When you set
android:singleLine="true"
one line text is in EditText visible but Enter key isn't visible in keypadmaxLines
when you set
android:maxLines
attribute with the particular value only same amount of line text is visible in EditText and enter key in keypad also visible for Entering.So When you click action button it is firing Enter Action according to your code. Also you must change your inputType attribute with
android:inputType="textMultiLine"
if you useandroid:maxLines
attributeWhen I customized your code with the correct attributes still it was firing Enter key instead of IME_ACTION_NEXT which you want. I think it didn't solve the problem due to
SOLUTION:
Subclass EditText and adjust the IME options. After that you don't need
android:maxLines
orandroid:singleLine
attributes.You could also check another post here. I reconfigured the accepted answer of this post on your purpose
android:digits
specifies that the EditText has a numeric input method, as per the docsYou could use
android:inputType="personName"
to achieve the same as your currentdigits
attryou can use
in place of
or
I know you have tried many solutions, Try with
these if you haven't tried earlier.
The workaround code for your solution are as below,
XML File
Java:
Here is a simplified solution with the software keyboard button "Next":
Here the regular expression
[^a-zA-Z0-9]+
corresponds to the allowed values ofandroid:digits
of theEditText
in question.