本文整理汇总了Java中android.text.TextWatcher.beforeTextChanged方法的典型用法代码示例。如果您正苦于以下问题:Java TextWatcher.beforeTextChanged方法的具体用法?Java TextWatcher.beforeTextChanged怎么用?Java TextWatcher.beforeTextChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextWatcher
的用法示例。
在下文中一共展示了TextWatcher.beforeTextChanged方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: beforeTextChanged
import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (!mIsSettingTextFromJS && mListeners != null) {
for (TextWatcher listener : mListeners) {
listener.beforeTextChanged(s, start, count, after);
}
}
}
示例2: refreshDropDownContents
import android.text.TextWatcher; //导入方法依赖的package包/类
private void refreshDropDownContents() {
Editable editable = editText.getEditableText();
TextWatcher[] watchers = editable.getSpans(0, editable.length(), TextWatcher.class);
if (watchers != null) {
for (TextWatcher watcher : watchers) {
watcher.beforeTextChanged(editable, 0, 0, 0);
watcher.onTextChanged(editable, 0, 0, 0);
watcher.afterTextChanged(editable);
}
}
}
示例3: beforeTextChanged
import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
for (TextWatcher watch : mTextWatchers) {
watch.beforeTextChanged(s, start, count, after);
}
}
示例4: simulateTextInput
import android.text.TextWatcher; //导入方法依赖的package包/类
private static String simulateTextInput(TextWatcher tw, String original, String input) {
// TODO review all the int parameters
tw.beforeTextChanged(original, 0, original.length(), input.length());
String newText = original + input;
tw.onTextChanged(newText, 1, newText.length() - 1, 1);
Editable editable = new SpannableStringBuilder(newText);
tw.afterTextChanged(editable);
return editable.toString();
}