本文整理汇总了Java中android.text.SpanWatcher类的典型用法代码示例。如果您正苦于以下问题:Java SpanWatcher类的具体用法?Java SpanWatcher怎么用?Java SpanWatcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpanWatcher类属于android.text包,在下文中一共展示了SpanWatcher类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invalidateSpanToClick
import android.text.SpanWatcher; //导入依赖的package包/类
private void invalidateSpanToClick() {
if (spanToClick == null) {
return;
}
CharSequence text = getText();
if (text instanceof Spannable) {
Spannable spannable = (Spannable) text;
int start = spannable.getSpanStart(spanToClick);
int end = spannable.getSpanEnd(spanToClick);
if (start >= 0 && end >= start) {
SpanWatcher[] watchers = spannable.getSpans(0, spannable.length(), SpanWatcher.class);
if (watchers != null && watchers.length >= 1) {
for (SpanWatcher watcher : watchers) {
if (watcher.getClass().getName().equals("android.widget.TextView$ChangeWatcher")) {
// Notify span changed to redraw it
watcher.onSpanChanged(spannable, spanToClick, start, end, start, end);
}
}
}
}
}
invalidate();
}
示例2: sendSpanAdded
import android.text.SpanWatcher; //导入依赖的package包/类
private void sendSpanAdded(Object what, int start, int end) {
SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
int n = recip.length;
for (int i = 0; i < n; i++) {
recip[i].onSpanAdded(this, what, start, end);
}
}
示例3: sendSpanRemoved
import android.text.SpanWatcher; //导入依赖的package包/类
private void sendSpanRemoved(Object what, int start, int end) {
SpanWatcher[] recip = getSpans(start, end, SpanWatcher.class);
int n = recip.length;
for (int i = 0; i < n; i++) {
recip[i].onSpanRemoved(this, what, start, end);
}
}
示例4: sendSpanChanged
import android.text.SpanWatcher; //导入依赖的package包/类
private void sendSpanChanged(Object what, int s, int e, int st, int en) {
SpanWatcher[] recip = getSpans(Math.min(s, st), Math.max(e, en),
SpanWatcher.class);
int n = recip.length;
for (int i = 0; i < n; i++) {
recip[i].onSpanChanged(this, what, s, e, st, en);
}
}