Android的EditText电话号码掩码
作者:互联网
我正在为Android开发应用程序.在此应用中,用户需要注册,并且需要输入电话号码.我想为此文本字段设置掩码,例如7(999)999-99-99.我试过使用mPhoneNumberEditText.addTextChangedListener(new PhoneNumberFormattingTextWatcher());但仅提供(999)999-9999格式.
我该如何格式化所需的格式?
解决方法:
This plugin can help:
https://github.com/pinball83/Masked-Edittext
<com.github.pinball83.maskededittext.MaskedEditText
android:id="@+id/masked_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number"
app:mask="+7 (***) ***-**-**"
app:notMaskedSymbol="*"/>
标签:android-edittext,android,phonenumberutils 来源: https://codeday.me/bug/20191119/2032608.html