android:imeOptions="actionNext" not working - android

I am creating signup page but and adding next button to every TextInputEditText and it is working perfectly without any issue,
but whenever I add android:digits="0123456789qwertzuiopasdfghjklyxcvbnm_ " in layout then it doesn't work.
What will be the probable reason for the solution for it??
below is my code snippet.
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColorHint="#c0c0c0"
app:errorEnabled="true"
app:theme="#style/MyTextInputLayoutStyle">
<com.google.android.material.textfield.TextInputEditText
android:id="#+id/activity_register_edit_text_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/state_region"
android:imeOptions="actionNext"
android:digits="0123456789qwertzuiopasdfghjklyxcvbnm_ "
android:inputType="textPersonName"
android:padding="#dimen/edittext_padding"
android:textColor="#color/text_color_light"
android:theme="#style/MyTextInputLayoutStyle"
app:errorTextAppearance="#style/TextErrorAppearance"
app:xfont="#string/roboto_regular" />
</com.google.android.material.textfield.TextInputLayout>
Thanks in advance.

When you set android:digits in EditText orTextInputEditText, it allows only digit or character which you have defined in it. In android soft input (Key Board) there is the next button have a unique code that is not defined in android: digits.
refer this link for better understanding

Related

Android talk back announcing incorrect content description for TextInputLayout when the the input type of EditText is password

I have a TextInputLayout with the following structure in my android app.
<com.google.android.material.textfield.TextInputLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:id="#+id/mEdit"
android:inputType="numberPassword"
android:maxLength="4"
android:singleLine="true"
app:layout_constraintTop_toTopOf="parent" />
</com.google.android.material.textfield.TextInputLayout>
Here the maxLength of EditText is 4. However, after enabling talk back if we try to edit something into the password field the talkback announces content description like Bullet, Maximum length reached even if we didn't reach the maxLength of the EditText.
Thanks in advance for your valuable thoughts.
Use com.google.android.material.textfield.TextInputEditText instead of using EditText in TextInputLayout.

NumberPad Keyboard without text preview

My question is simple: I want to show a NumberPad keyboard on my android app without text preview and "Done" button. Just like the keypad that is shown on WhatsApp when user submits his phone number.
I hope the answer would be a simple one too! :)
You should try with textNoSuggestions
android:inputType="textNoSuggestions"
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:inputType="numberPassword"
android:maxLength="10"
android:maxLines="1"
android:padding="10dp"
android:singleLine="true"
android:textColor="#android:color/black" />
android:inputType="numberPassword"

How to make Edit Text hint appear when typing

I would like for my app to be able to display different hints in the edittext at different times, so i have to set the hint pro-grammatically at each times as below.
editText.setHint("Hint 1");
But the problem is when i starts typing the hint starts disappearing.I want to show this hint every time.If i set the hint in xml it will not disappear while typing, but how to do this in my case.
Either you should consider to change to TextInputLayout(Strongly recommended this. Here is an example too.)
or
make relative layout with EditText for input and TextView for hint inside.Change the textview according to your needs.
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Some text"
android:layout_alignParentLeft="true"
android:id="#+id/editText1"
android:layout_gravity="center"
/>
<TextView
android:id="#+id/text_hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="yourHint"
android:textSize="14sp"
android:layout_marginRight="10dp"
android:textColor="#color/customColor"
/>
</RelativeLayout>
what you are expecting is not possible,since we have to how what user is writing on editext.
Now a days https://github.com/hardik-trivedi/FloatingLabel
this type of hints are more popular,you can try above link.
TextInputLayout give powerful material features to EditText. Main feature is floating hint. See doc here https://developer.android.com/reference/android/support/design/widget/TextInputLayout.html
You can't display while typing text in edit text hint in android have default functionality
<android.support.design.widget.TextInputLayout
android:theme="#style/TextLabel"
android:id="#+id/input_layout_username"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/username_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#null"
android:hint="Email Address"
android:inputType="textEmailAddress"
android:translationY="10dp"
android:textColor="#color/white"
android:textColorHint="#color/white"
android:textSize="#dimen/font_13"/>
</android.support.design.widget.TextInputLayout>
Here android provide default functionality while typing text in edit text the hint above edit text, You can also set Hint via programmatically
EditText. setHint ("Hint 1");
the best way to do this is to use TextInputLayout.
https://www.bignerdranch.com/blog/becoming-material-with-android-design-support-library/
<!--EMAIL-->
<android.support.design.widget.TextInputLayout
android:id="#+id/email_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/TextLabel">
<EditText
android:id="#+id/etUserName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/login_screen_email_hint"
android:imeOptions="actionNext"
android:inputType="textEmailAddress"
android:maxLines="1"
android:nextFocusDown="#+id/etPassword"
android:singleLine="true"
android:textColor="#android:color/white"
android:textColorHighlight="#android:color/white"
android:textColorHint="#android:color/white" />
</android.support.design.widget.TextInputLayout>
And dont forget adding this line to your gradle file
compile 'com.android.support:design:23.4.0'

Android Softkeyboard "Done" key gone

I'm making an APP and want to change the keyboard "Line Break" key into a "Done" key, But I cant use the android:signleLine="true" (seen here: Done key not showing up on keyboard) because the EditText isn't the last EditText in my code.
What could I use/do instead?
Thanks.
Edit
Here is my code:
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:width="40dp"
android:maxLength="1"
android:lines="1"
android:textStyle="bold"
android:inputType="textCapCharacters|textFilter"
android:digits="ABCDEFGHIJKLMNOPQRSTUVXYZ"
android:textAlignment="center"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"/>
You can use to set the keyboard action button imeOptions
<EditText
android:id="#+id/search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="#string/search_hint"
android:inputType="text"
android:imeOptions="actionDone" />
Read more about imeOptions here
You will also have to remove the line
android:digits="ABC..."
as imeOptions do not work well with this.
You can Try this.
By XML
android:imeOptions="actionDone"
By Java
editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
this may helps you.

Arabic language is not supported with the use of inputType

I had an issue with setting hint in Arabic language. Please refer Alternating edit text hint not visible for Arabic language
for details. The issue was with the use of inputType in the xml. I have removed it and now a normal keypad appears onclick of the edittext field. But I want the user to enter numbers only and I want numerical keypad to appear. How to do it?
In short, the use of inputType will not display the Arabic content and if it is not used then I am getting alphabetical keypad.
Please help, thanks in advance
hope you can use this property android:numeric="integer" and please remove singleline property if you are using it.
<EditText
android:id="#+id/et_account_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cursorVisible="true"
android:gravity="right"
android:hint="#string/hint_account_no"
android:imeOptions="actionNext"
android:numeric="integer"
android:maxLength="12"
android:textColor="#android:color/black"
android:textSize="20sp"
android:padding="#dimen/edittext_padding">
</EditText>
Use android:inputType="number" or android:inputType="phone" it should give you numeric keypad on click of edit text:
Following is the snippet from my xml, this should help:
<EditText
android:layout_gravity="start"
android:textAlignment="viewStart"
android:hint="my hint"
android:inputType="phone"
android:id="#+id/Nummm"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:textDirection="rtl"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:background="#android:color/transparent"
android:textColorHint="#767676"
android:backgroundTint="#android:color/transparent"
android:layout_height="fill_parent"
tools:ignore="RtlCompat" />

Categories

Resources