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