当前位置: 首页>>代码示例>>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;未经允许,请勿转载。