private boolean hasStyleSpan(Spanned spanned) { // Only check against those three classes below, which could affect text appearance, since // there are other kind of classes won't affect appearance. Class<?>[] styleClasses = { CharacterStyle.class, ParagraphStyle.class, UpdateAppearance.class}; for (Class<?> clazz : styleClasses) { if (spanned.nextSpanTransition(-1, spanned.length(), clazz) < spanned.length()) { return true; } } return false; }
private boolean hasStyleSpan(Spanned spanned) { Class<?>[] styleClasses = { CharacterStyle.class, ParagraphStyle.class, UpdateAppearance.class}; for (Class<?> clazz : styleClasses) { if (spanned.nextSpanTransition(-1, spanned.length(), clazz) < spanned.length()) { return true; } } return false; }
private static void textTransform(TextView view, UpdateAppearance appearance) { SpannableString viewText = new SpannableString(view.getText()); viewText.setSpan(appearance, 0, viewText.length(), 0); view.setText(viewText); }