当前位置: 首页>>代码示例>>Java>>正文


Java SpanWatcher类代码示例

本文整理汇总了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();
}
 
开发者ID:Mishiranu,项目名称:Dashchan,代码行数:24,代码来源:CommentTextView.java

示例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);
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:9,代码来源:SpannableStringBuilder.java

示例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);
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:9,代码来源:SpannableStringBuilder.java

示例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);
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:10,代码来源:SpannableStringBuilder.java


注:本文中的android.text.SpanWatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。