In Android, AutoCompleteTextView is used to format the mobile phone number with the operation of clearing the history

A small partner encountered such a problem, that is, AutoCompleteTextView realizes the function of automatic filling. At the same time, it should have the function of mobile phone formatting. The last line of the drop-down list has a function to clear history. However, click "clear history" to set the text into autocomplete textview. This effect is obviously very bad. So I wrote such a simple demo. To help friends who encounter such problems solve such a problem. Two words don't say much, directly on the code.

The code of the layout file (activity_main. XML) is as follows:

The code of the java file (mainactivity. Java) is as follows:

The above is what Xiaobian introduced to you. In Android, AutoCompleteTextView is used to format mobile phone numbers with the operation of clearing history. I hope it will be helpful to you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>