Currently I have a really simple code that validates EditText
fields and when the user hits the button at the end it checks them. It will put errors in all the fields with this:
if (!emailmatcher.matches()) { email.setError("Invalid Email"); } if (!zipmatcher.matches()) { zipcode.setError("Invalid ZipCode"); }
My problem that is the keyboard will popup and will move the error bubble to a random place. I was hoping to not have a error bubbles with a message but keep the error icons in invalid EditText
fields. I tried inputting setError(null)
but that doesn't work. Any Ideas?
2- First thing we need to do is to look for icons that we can use them for the android edittext. Right click on res folder → New → Vector Asset . Adjust the size from (24dp x 24dp) to (18dp x 18dp), choose the icon that you want by clicking on the android icon, click “Next” button and then click “Finish”.
EditText editText=(EditText)findViewById(R. id. editText); editText. setTextIsSelectable(false);
In your xml code set focusable="false" , android:clickable="false" and android:cursorVisible="false" and this will make your EditText treat like non editable.
Your code perfect to show icon only.
As EditText
is show anything related to when it has focused. So just change your code to like that...
if (!emailmatcher.matches()) { email.requestFocus(); email.setError("Invalid Email"); } if (!zipmatcher.matches()) { zipcode.requestFocus(); zipcode.setError("Invalid ZipCode"); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With