I have several EditTexts in my Activty and I want my users to give inputs correctly before submitting the form. How can I do It? I have also spinners and RadioGroup Button.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Apply validation for editText and all your other components in button.setOnClickListner
if all the validation satisfy then do further process.
like for edittext validation
You can add Validation on submit button click:
On Submit button Click:
Output will be like this. Photo Credit.
Hope this helps.
I get your point, you can use TextInputLayout instead of EditText
define your
xml
layout:then you can use helper method inside your button click listener to validate the input data of all your editText
don't forget to add the design support library dependency
see this example: Creating a Login Screen Using TextInputLayout
it will be something like that if the user enter invalid data it will show this warning in red lines![enter image description here](https://i.stack.imgur.com/VP4oS.png)
Try this: code
use
setOnFocusChangeListener()
on the Editext