本文整理汇总了Java中android.text.Spanned.toString方法的典型用法代码示例。如果您正苦于以下问题:Java Spanned.toString方法的具体用法?Java Spanned.toString怎么用?Java Spanned.toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.Spanned
的用法示例。
在下文中一共展示了Spanned.toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeJumpingBeansSpansFrom
import android.text.Spanned; //导入方法依赖的package包/类
private static CharSequence removeJumpingBeansSpansFrom(Spanned text) {
SpannableStringBuilder sbb = new SpannableStringBuilder(text.toString());
Object[] spans = text.getSpans(0, text.length(), Object.class);
for (Object span : spans) {
if (!(span instanceof JumpingBeansSpan)) {
sbb.setSpan(span, text.getSpanStart(span), text.getSpanEnd(span), text.getSpanFlags(span));
}
}
return sbb;
}
示例2: initViews
import android.text.Spanned; //导入方法依赖的package包/类
private void initViews() {
toolbar.setTitle("");
setSupportActionBar(toolbar);
logo.bringToFront();
logo.requestLayout();
logo.invalidate();
InputFilter[] filters = new InputFilter[1];
filters[0] = new InputFilter() {
@Override
public CharSequence filter(CharSequence source, int start,
int end, Spanned dest, int dstart, int dend) {
if (end > start) {
String destTxt = dest.toString();
String resultingTxt = destTxt.substring(0, dstart) +
source.subSequence(start, end) +
destTxt.substring(dend);
if (!resultingTxt.matches("^\\d{1,3}(\\." +
"(\\d{1,3}(\\.(\\d{1,3}(\\.(\\d{1,3})?)?)?)?)?)?")) {
return "";
} else {
String[] splits = resultingTxt.split("\\.");
for (int i = 0; i < splits.length; i++) {
if (Integer.valueOf(splits[i]) > 255) {
return "";
}
}
}
}
return null;
}
};
firstDnsEdit.setFilters(filters);
secondDnsEdit.setFilters(filters);
ViewCompat.setTranslationZ(logo, 8);
}
示例3: removeJumpingBeansSpansFrom
import android.text.Spanned; //导入方法依赖的package包/类
private static CharSequence removeJumpingBeansSpansFrom(Spanned text) {
SpannableStringBuilder sbb = new SpannableStringBuilder(text.toString());
Object[] spans = text.getSpans(0, text.length(), Object.class);
for (Object span : spans) {
if (!(span instanceof JumpingBeansSpan)) {
sbb.setSpan(span, text.getSpanStart(span),
text.getSpanEnd(span), text.getSpanFlags(span));
}
}
return sbb;
}