當前位置: 首頁>>代碼示例>>Java>>正文


Java TextView.setLinkTextColor方法代碼示例

本文整理匯總了Java中android.widget.TextView.setLinkTextColor方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setLinkTextColor方法的具體用法?Java TextView.setLinkTextColor怎麽用?Java TextView.setLinkTextColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setLinkTextColor方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCustomiseDialog

import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected @NonNull DynamicDialog onCustomiseDialog(@NonNull DynamicDialog alertDialog,
                                                   @Nullable Bundle savedInstanceState) {
    View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_about,
            new LinearLayout(getContext()), false);
    TextView message = view.findViewById(R.id.dialog_about_text);

    message.setText(Html.fromHtml(getString(R.string.about_content)
            .replace("\n", "<br/>")));
    message.setTextSize(TypedValue.COMPLEX_UNIT_SP, TEXT_SIZE);
    message.setLineSpacing(0f, 1.2f);
    message.setMovementMethod(LinkMovementMethod.getInstance());
    message.setLinkTextColor(ContextCompat.getColor(getContext(), R.color.colorPrimary));

    alertDialog.setView(view);
    return alertDialog;
}
 
開發者ID:pranavpandey,項目名稱:dynamic-toasts,代碼行數:18,代碼來源:AboutDialogFragment.java

示例2: process

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void process(@NonNull Context context, @Nullable String key, @NonNull View view, @NonNull String suffix) {
    final TextView tv = (TextView) view;
    final ColorResult result = getColorFromSuffix(context, key, view, suffix);
    if (result == null) return;

    if (mHintMode)
        result.adjustAlpha(0.5f);

    final ColorStateList sl = getTextSelector(result.getColor(), view, false);
    if (mLinkMode) {
        tv.setLinkTextColor(sl);
    } else if (mHintMode) {
        tv.setHintTextColor(sl);
        // Sets parent TextInputLayout hint color
        if (view.getParent() != null && view.getParent() instanceof TextInputLayout) {
            final TextInputLayout til = (TextInputLayout) view.getParent();
            TextInputLayoutUtil.setHint(til, result.getColor());
        }
    } else {
        tv.setTextColor(sl);
    }
}
 
開發者ID:RajneeshSingh007,項目名稱:MusicX-music-player,代碼行數:24,代碼來源:TextColorTagProcessor.java

示例3: createAndShowDialog

import android.widget.TextView; //導入方法依賴的package包/類
private static void createAndShowDialog(Context context, String title,
                                        SpannableString message, boolean showOkButton) {

    Linkify.addLinks(message, Patterns.WEB_URL, null, new Linkify.MatchFilter() {
        @Override
        public boolean acceptMatch(CharSequence seq, int start, int end) {
            return Linkify.sUrlMatchFilter.acceptMatch(seq, start, end);
        }
    }, null);

    final Dialog dialog = new LovelyInfoDialog(context)
            .setTopColorRes(R.color.colorPrimaryLight)
            .setTitle(title)
            .setIcon(R.drawable.ic_info_outline)
            .setMessage(message)
            .show();

    TextView tvMessage = (TextView) dialog.findViewById(R.id.ld_message);
    if (tvMessage != null) {
        tvMessage.setMovementMethod(LinkMovementMethod.getInstance());
        tvMessage.setLinkTextColor(ContextCompat.getColor(context, R.color.blue));
    }

    if (showOkButton) {
        Button btnOk = (Button) dialog.findViewById(R.id.ld_btn_confirm);
        if (btnOk != null) {
            btnOk.setText(R.string.button_ok);
            btnOk.setTextColor(ContextCompat.getColor(context, R.color.colorPrimaryDark));
        }
    }
}
 
開發者ID:wahibhaq,項目名稱:urdu-font-comparator-app,代碼行數:32,代碼來源:Utils.java

示例4: TextInfoPrivacyCell

import android.widget.TextView; //導入方法依賴的package包/類
public TextInfoPrivacyCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setTextColor(0xff808080);
    textView.setLinkTextColor(Theme.MSG_LINK_TEXT_COLOR);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    textView.setPadding(0, AndroidUtilities.dp(10), 0, AndroidUtilities.dp(17));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0));
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:14,代碼來源:TextInfoPrivacyCell.java

示例5: TextInfoPrivacyCell

import android.widget.TextView; //導入方法依賴的package包/類
public TextInfoPrivacyCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(0xff808080);
    textView.setLinkTextColor(0xff316f9f);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
    textView.setPadding(0, AndroidUtilities.dp(10), 0, AndroidUtilities.dp(17));
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.TOP, 17, 0, 17, 0));
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:14,代碼來源:TextInfoPrivacyCell.java

示例6: setupTextColor

import android.widget.TextView; //導入方法依賴的package包/類
public static void setupTextColor(TextView view, AttributeSet attrs) {
    StyledAttributesHelper r = StyledAttributesHelper.obtainStyledAttributes(view.getContext(), attrs, THEME_ATTRS);
    int colorResId = r.getResourceId(android.R.attr.textColor, 0);
    if (colorResId == 0) {
        int appearanceRes = r.getResourceId(android.R.attr.textAppearance, 0);
        if (appearanceRes != 0) {
            StyledAttributesHelper ta = StyledAttributesHelper.obtainStyledAttributes(
                    view.getContext(), appearanceRes, new int[] { android.R.attr.textColor });
            colorResId = ta.getResourceId(android.R.attr.textColor, 0);
            ta.recycle();
        }
    }
    if (colorResId == R.color.colorPrimary)
        view.setTextColor(ThemeHelper.getPrimaryColor(view.getContext()));
    else if (colorResId == R.color.colorAccent)
        view.setTextColor(ThemeHelper.getAccentColor(view.getContext()));
    colorResId = r.getResourceId(android.R.attr.textColorLink, 0);
    if (colorResId == R.color.colorAccent)
        view.setLinkTextColor(ThemeHelper.getAccentColor(view.getContext()));

    Drawable[] drawables = TextViewCompat.getCompoundDrawablesRelative(view);
    boolean hasChange = false;
    for (int i = 0; i < 4; i++) {
        Drawable newDrawable = tintDrawable(view.getContext(), r, DRAWABLE_ATTRS[i], drawables[i]);
        if (newDrawable != drawables[i]) {
            drawables[i] = newDrawable;
            hasChange = true;
        }
    }
    if (hasChange)
        TextViewCompat.setCompoundDrawablesRelative(view, drawables[0], drawables[1], drawables[2], drawables[3]);
    r.recycle();
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:34,代碼來源:ThemedTextView.java

示例7: showFontDetailsDialog

import android.widget.TextView; //導入方法依賴的package包/類
public void showFontDetailsDialog(Context context, String title, String message, double rating,
                                  int ratingCount) {
    LayoutInflater inflater = (LayoutInflater)
            context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    final View viewFontDetails = inflater.inflate(R.layout.dialog_font_details, null);

    //To make sure Font FileName doesn't end up as a clickable url because it is automatically
    //turned into a url
    final SpannableString content = new SpannableString(message);
    Linkify.addLinks(content, Patterns.WEB_URL, null, new Linkify.MatchFilter() {
        @Override
        public boolean acceptMatch(CharSequence seq, int start, int end) {
            String url = seq.subSequence(start, end).toString();
            //Apply the default matcher too. This will remove filenames that matched.
            return !url.contains(".ttf") && Linkify.sUrlMatchFilter
                    .acceptMatch(seq, start, end);
        }
    }, null);

    TextView tvMessage = (TextView) viewFontDetails
            .findViewById(R.id.text_font_details_message);
    if (tvMessage != null) {
        tvMessage.setText(content);
        tvMessage.setMovementMethod(LinkMovementMethod.getInstance()); //Making link clickable
        tvMessage.setLinkTextColor(ContextCompat.getColor(context, R.color.blue));
    }

    final Dialog dialog = new LovelyCustomDialog(context)
            .setView(viewFontDetails)
            .setTopColorRes(R.color.colorPrimaryLight)
            .setTitle(title)
            .setIcon(R.drawable.ic_info_outline)
            .show();
    TextView btnGotIt = (TextView) viewFontDetails.findViewById(R.id.button_font_details_got_it);
    btnGotIt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (dialog != null && dialog.isShowing()) {
                dialog.dismiss();
            }
        }
    });
    TextView tvRating = (TextView) viewFontDetails.findViewById(R.id.tv_rating);
    Resources res = getResources();
    String text = res.getQuantityString(R.plurals.dialog_font_rating, ratingCount,
            formatToOneDecimalPlace(rating),
            formatToOneDecimalPlace(res.getInteger(R.integer.rating_max_possible_value)),
            ratingCount);
    tvRating.setText(text);
}
 
開發者ID:wahibhaq,項目名稱:urdu-font-comparator-app,代碼行數:51,代碼來源:MainFragment.java

示例8: themeChange

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void themeChange(ThemeEnum themeEnum, int[] colors) {
    ThemeEnum theme = appPreference.getTheme();
    int[] cs = ColorUtils.get10ThemeColors(this, theme);
    int accentC = cs[2];
    int mainTC = cs[5];
    int vicTC = cs[6];

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        send.setBackgroundTintList(ColorStateList.valueOf(accentC));
    }

    input.setHintTextColor(vicTC);
    input.setTextColor(mainTC);
    initInputBg(accentC, theme == ThemeEnum.WHITE ? Color.WHITE : cs[4]);

    TextView cent = (TextView) findViewById(R.id.feedback_tip_msg);
    TextView other = (TextView) findViewById(R.id.feedback_tip_other_where);
    TextView tip = (TextView) findViewById(R.id.feedback_tip);
    View tipLine = findViewById(R.id.feedback_tip_line);
    TextView tipO = (TextView) findViewById(R.id.feedback_tip_ow);
    View tipOL = findViewById(R.id.feedback_tip_ow_line);
    cent.setTextColor(vicTC);
    other.setTextColor(vicTC);
    other.setLinkTextColor(accentC);

    tipLine.setBackgroundColor(vicTC);
    tip.setTextColor(mainTC);

    tipOL.setBackgroundColor(vicTC);
    tipO.setTextColor(mainTC);

    int[] cs2 = ColorUtils.get2ActionStatusBarColors(this);
    int actionC = cs2[0];
    int statusC = cs2[1];
    toolbar.setBackgroundColor(statusC);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(actionC);
    }

}
 
開發者ID:DuanJiaNing,項目名稱:Musicoco,代碼行數:42,代碼來源:FeedBackActivity.java


注:本文中的android.widget.TextView.setLinkTextColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。