Java Code Examples for android.text.TextPaint#setUnderlineText()
The following examples show how to use
android.text.TextPaint#setUnderlineText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LearnMoreTextView.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
private void init() { setMovementMethod(LinkMovementMethod.getInstance()); ClickableSpan clickable = new ClickableSpan() { @Override public void updateDrawState(@NonNull TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(false); ds.setColor(ThemeUtil.getThemedColor(getContext(), R.attr.colorAccent)); } @Override public void onClick(@NonNull View widget) { if (linkListener != null) { linkListener.onClick(widget); } } }; link = new SpannableString(getContext().getString(R.string.LearnMoreTextView_learn_more)); link.setSpan(clickable, 0, link.length(), Spanned.SPAN_INCLUSIVE_EXCLUSIVE); visible = true; }
Example 2
Source File: IconicsDrawableOld.java From clear-todolist with GNU General Public License v3.0 | 6 votes |
/** * Create an IconDrawable. * Just give it the icon-identifier * * @param context Your activity or application context. * @param icon The icon identifier without icon- (font must be registered) */ public IconicsDrawableOld(Context context, String icon) { this.context = context; ITypeface font = Iconics.findFont(icon.substring(0, 3)); icon = icon.replace("-", "_"); this.icon = font.getIcon(icon); paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); paint.setTypeface(font.getTypeface(context)); paint.setStyle(Paint.Style.STROKE); paint.setTextAlign(Paint.Align.CENTER); paint.setUnderlineText(false); paint.setColor(Color.BLACK); paint.setAntiAlias(true); }
Example 3
Source File: HelperUrl.java From iGap-Android with GNU Affero General Public License v3.0 | 6 votes |
private static void insertIgapBot(final SpannableStringBuilder strBuilder, final int start, final int end) { ClickableSpan clickable = new ClickableSpan() { public void onClick(View view) { G.isLinkClicked = true; String botCommandText = strBuilder.toString().substring(start, end); if (G.onBotClick != null) { G.onBotClick.onBotCommandText(botCommandText); } } @Override public void updateDrawState(TextPaint ds) { ds.linkColor = Color.parseColor(G.linkColor); super.updateDrawState(ds); ds.setUnderlineText(false); } }; strBuilder.setSpan(clickable, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); }
Example 4
Source File: MultiActionClickableSpan.java From ProjectX with Apache License 2.0 | 5 votes |
@Override public void updateDrawState(TextPaint ds) { ds.setUnderlineText(mUnderline); ds.clearShadowLayer(); if (changeColor) ds.setColor(mColor); }
Example 5
Source File: IconicsDrawableOld.java From clear-todolist with GNU General Public License v3.0 | 5 votes |
/** * Create an IconDrawable. * * @param font The font to use for this drawable * @param context Your activity or application context. * @param icon The icon you want this drawable to display. */ public IconicsDrawableOld(Context context, ITypeface font, IIcon icon) { this.context = context; this.icon = icon; paint = new TextPaint(Paint.ANTI_ALIAS_FLAG); paint.setTypeface(font.getTypeface(context)); paint.setStyle(Paint.Style.STROKE); paint.setTextAlign(Paint.Align.CENTER); paint.setUnderlineText(false); paint.setColor(Color.BLACK); paint.setAntiAlias(true); }
Example 6
Source File: TouchableSpan.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(mIsPressed ? mPressedTextColor : mNormalTextColor); ds.bgColor = mIsPressed ? mPressedBackgroundColor : 0x00eeeeee; ds.setUnderlineText(false); }
Example 7
Source File: AbsClickSpan.java From umeng_community_android with MIT License | 5 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setColor(ResFinder.getColor("umeng_comm_wrapper_text_color"));// 设置文本颜色 // 去掉下划线 ds.setUnderlineText(false); }
Example 8
Source File: ColorSpanUnderline.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(true); }
Example 9
Source File: SocialFriendAdapter.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 4 votes |
@Override public void updateDrawState(TextPaint ds) { ds.setUnderlineText(false); // 去掉下划线 }
Example 10
Source File: SignInActivity.java From monolog-android with MIT License | 4 votes |
@Override public void updateDrawState(TextPaint ds) { ds.setColor(ds.linkColor); ds.setUnderlineText(false); }
Example 11
Source File: URLSpanNoUnderlineBold.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); ds.setUnderlineText(false); }
Example 12
Source File: PaymentFormActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(false); }
Example 13
Source File: TouchableUrlSpan.java From materialup with Apache License 2.0 | 4 votes |
@Override public void updateDrawState(TextPaint drawState) { drawState.setColor(isPressed ? pressedTextColor : normalTextColor); drawState.bgColor = isPressed ? pressedBackgroundColor : 0; drawState.setUnderlineText(!isPressed); }
Example 14
Source File: InfoDialogPreferenceFragmentX.java From PhoneProfilesPlus with Apache License 2.0 | 4 votes |
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); final TextView infoTextView = view.findViewById(R.id.info_pref_dialog_info_text); String _infoText = preference.infoText; int tagIndex = 0; String beginTag = "<II"+tagIndex+" ["; int importantInfoTagBeginIndex = _infoText.indexOf(beginTag); int importantInfoTagEndIndex = _infoText.indexOf("]>"); if (importantInfoTagBeginIndex != -1) { String importantInfoTagDataString = _infoText.substring(importantInfoTagBeginIndex + beginTag.length(), importantInfoTagEndIndex); /*if (PPApplication.logEnabled()) { PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "importantInfoTagBeginIndex=" + importantInfoTagBeginIndex); PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "importantInfoTagEndIndex=" + importantInfoTagEndIndex); PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "importantInfoTagDataString=" + importantInfoTagDataString); }*/ beginTag = "<II" + tagIndex + " [" + importantInfoTagDataString + "]>"; //PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "beginTag="+beginTag); String endTag = "<II" + tagIndex + "/>"; //PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "endTag="+endTag); importantInfoTagBeginIndex = _infoText.indexOf(beginTag); importantInfoTagEndIndex = _infoText.indexOf(endTag); //String clickableString = _infoText.substring(importantInfoTagBeginIndex + beginTag.length(), importantInfoTagEndIndex); //PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "clickableString=" + clickableString); _infoText = _infoText.replace(beginTag, ""); _infoText = _infoText.replace(endTag, ""); //PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView", "_infoText=" + _infoText); final String _tagType = beginTag.substring(1, 3); final String _importantInfoTagDataString = importantInfoTagDataString; Spannable sbt = new SpannableString(_infoText); /*sbt.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), importantInfoTagBeginIndex, importantInfoTagEndIndex-beginTag.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);*/ /*sbt.setSpan(new RelativeSizeSpan(1.05f), importantInfoTagBeginIndex, importantInfoTagEndIndex-beginTag.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);*/ ClickableSpan clickableSpan = new ClickableSpan() { @Override public void updateDrawState(TextPaint ds) { ds.setColor(ds.linkColor); // you can use custom color ds.setUnderlineText(false); // this remove the underline } @Override public void onClick(@NonNull View textView) { /*if (PPApplication.logEnabled()) { PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView.onClick", "_tagType=" + _tagType); PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView.onClick", "_importantInfoTagDataString=" + _importantInfoTagDataString); }*/ String[] splits = _importantInfoTagDataString.split(","); int page = Integer.parseInt(splits[0]); int resource = Integer.parseInt(splits[1]); /*if (PPApplication.logEnabled()) { PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView.onClick", "page=" + page); PPApplication.logE("InfoDialogPreferenceFragmentX.onBindDialogView.onClick", "resource=" + resource); }*/ if (_tagType.equals("II")) { Intent intentLaunch = new Intent(context, ImportantInfoActivity.class); intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, page == 1); intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SCROLL_TO, resource); startActivity(intentLaunch); } if (getDialog() != null) getDialog().cancel(); } }; sbt.setSpan(clickableSpan, importantInfoTagBeginIndex, importantInfoTagEndIndex - beginTag.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); infoTextView.setText(sbt); infoTextView.setClickable(true); infoTextView.setMovementMethod(LinkMovementMethod.getInstance()); } else { if (preference.isHtml) infoTextView.setText(GlobalGUIRoutines.fromHtml(preference.infoText, true, false, 0, 0)); else infoTextView.setText(preference.infoText); } }
Example 15
Source File: NoUnderlineClickableSpan.java From 365browser with Apache License 2.0 | 4 votes |
@Override public void updateDrawState(TextPaint textPaint) { super.updateDrawState(textPaint); textPaint.setUnderlineText(false); }
Example 16
Source File: CustomLinkSpan.java From GSYRickText with MIT License | 4 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(true); ds.setTypeface(Typeface.DEFAULT_BOLD); }
Example 17
Source File: URLSpanNoUnderlineBold.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); ds.setUnderlineText(false); }
Example 18
Source File: LinkSpan.java From GSYRickText with MIT License | 4 votes |
@Override public void updateDrawState(TextPaint ds) { ds.setColor(color); /** 去掉下划线 , 默认自带下划线 **/ ds.setUnderlineText(false); }
Example 19
Source File: LongClickableURLSpan.java From RichText with MIT License | 4 votes |
@Override public void updateDrawState(TextPaint ds) { ds.setColor(linkHolder.getColor()); ds.setUnderlineText(linkHolder.isUnderLine()); }
Example 20
Source File: WeiboSpan.java From BlackLight with GNU General Public License v3.0 | 4 votes |
@Override public void updateDrawState(TextPaint ds) { ds.setColor(ds.linkColor); ds.setUnderlineText(false); }