本文整理匯總了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();
}