How to set Edittext view allow only two numeric values and two decimal values like ##.##

后端 未结 2 1930
旧巷少年郎
旧巷少年郎 2020-12-11 12:31

I need to set validation for a edittext view should allow two numeric values and two decimal values. example: 22.32

Please let me know how to do this validation

2条回答
  •  我在风中等你
    2020-12-11 13:33

    boolean isValid=.getText().toString().matches("\\d{2}\\.\\d{2}");
    

    Put this method in a onClickListener and I guess you will be good to go.

提交回复
热议问题