public class PhoneNumberFormattingTextWatcher
extends Object implements TextWatcher
| java.lang.Object | |
| android.telephony.PhoneNumberFormattingTextWatcher | |
手表 TextView ,如果输入电话号码将格式化。
当用户停止格式化
一旦文本被清除,格式化将重新开始。
Public constructors |
|
|---|---|
PhoneNumberFormattingTextWatcher() 格式化基于当前系统区域设置,将来的区域设置更改可能不会对此实例生效。 |
|
PhoneNumberFormattingTextWatcher(String countryCode) 格式是基于给定的 |
|
公共方法(Public methods) |
|
|---|---|
void |
afterTextChanged(Editable s) 调用此方法通知您,在 |
void |
beforeTextChanged(CharSequence s, int start, int count, int after) 这种方法被调用来通知您,内 |
void |
onTextChanged(CharSequence s, int start, int before, int count) 这种方法被调用来通知您,内 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
android.text.TextWatcher
|
|
PhoneNumberFormattingTextWatcher ()
格式化基于当前系统区域设置,将来的区域设置更改可能不会对此实例生效。
PhoneNumberFormattingTextWatcher (String countryCode)
格式是基于给定的 countryCode 。
| 参数(Parameters) | |
|---|---|
countryCode |
String: the ISO 3166-1 two-letter country code that indicates the country/region where the phone number is being entered. |
void afterTextChanged (Editable s)
调用此方法通知您,在s之内的某个地方,文本已被更改。 从这个回调中对s做进一步修改是合理的,但要小心不要让自己陷入无限循环,因为你所做的任何修改都会导致这个方法再次被递归调用。 (你没有被告知发生了什么变化,因为其他的afterTextChanged()方法可能已经做了其他的更改并且使得偏移无效。但是如果你需要知道这里,你可以使用setSpan(Object, int, int, int)中的onTextChanged(CharSequence, int, int, int)来标记你的位置,在这里跨度结束了。
| 参数(Parameters) | |
|---|---|
s |
Editable
|
void beforeTextChanged (CharSequence s, int start, int count, int after)
这种方法被调用来通知您,内s ,该count在最初的文字start即将被新文本替换长度为after 。 尝试从此回调中更改s是错误的。
| 参数(Parameters) | |
|---|---|
s |
CharSequence
|
start |
int
|
count |
int
|
after |
int
|
void onTextChanged (CharSequence s, int start, int before, int count)
这种方法被调用来通知您,内s ,该count在最初的文字start刚刚取代了长了旧文本before 。 尝试从此回调中更改s是错误的。
| 参数(Parameters) | |
|---|---|
s |
CharSequence
|
start |
int
|
before |
int
|
count |
int
|