本文整理了Java中android.widget.TextView.setAutoLinkMask()
方法的一些代码示例,展示了TextView.setAutoLinkMask()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setAutoLinkMask()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setAutoLinkMask
暂无
代码示例来源:origin: TeamNewPipe/NewPipe
videoDescriptionView = rootView.findViewById(R.id.detail_description_view);
videoDescriptionView.setMovementMethod(LinkMovementMethod.getInstance());
videoDescriptionView.setAutoLinkMask(Linkify.WEB_URLS);
代码示例来源:origin: robolectric/robolectric
@Test
public void testGetUrls() throws Exception {
Locale.setDefault(Locale.ENGLISH);
textView.setAutoLinkMask(Linkify.ALL);
textView.setText("here's some text http://google.com/\nblah\thttp://another.com/123?456 blah");
assertThat(urlStringsFrom(textView.getUrls())).isEqualTo(asList(
"http://google.com",
"http://another.com/123?456"
));
}
代码示例来源:origin: kaku2015/ColorfulNews
@Override
public void initViews() {
mMsgTv.setAutoLinkMask(Linkify.ALL);
mMsgTv.setMovementMethod(LinkMovementMethod.getInstance());
}
}
代码示例来源:origin: chat-sdk/chat-sdk-android
public BaseMessageViewHolder(View itemView, Activity activity) {
super(itemView, activity);
timeTextView = itemView.findViewById(R.id.txt_time);
avatarImageView = itemView.findViewById(R.id.avatar);
messageBubble = itemView.findViewById(R.id.message_bubble);
messageTextView = itemView.findViewById(R.id.txt_content);
messageIconView = itemView.findViewById(R.id.icon);
messageImageView = itemView.findViewById(R.id.image);
extraLayout = itemView.findViewById(R.id.extra_layout);
readReceiptImageView = itemView.findViewById(R.id.read_receipt);
progressBar = itemView.findViewById(R.id.progress_bar);
itemView.setOnClickListener(v -> {
onClick(v);
});
itemView.setOnLongClickListener(v -> {
return onLongClick(v);
});
if(readReceiptImageView != null) {
readReceiptImageView.setVisibility(ChatSDK.readReceipts() != null ? View.VISIBLE : View.INVISIBLE);
}
// Enable linkify
messageTextView.setAutoLinkMask(Linkify.ALL);
}
代码示例来源:origin: stackoverflow.com
TextView tv = new TextView();
tv.setAutoLinkMask(Linkify.WEB_URLS);
tv.setAutoLinkMask(Html.fromHtml("<a href=\"file:///sdcard/PIC_20150721_- 1_1245263.jpg\">PIC_20150721_-1_1245263.jpg</a>"));
tv.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(tv, Linkify.ALL);
代码示例来源:origin: stackoverflow.com
TextView emailLink = new TextView(myActivity.this);
emailLink.setAutoLinkMask(true);
emailLink.setText("mailto://<your email address>");
AlertDialog aboutBox = new AlertDialog(myActivity.this);
aboutBox.setView(emailLink);
代码示例来源:origin: stackoverflow.com
String message="Some message ";
message=message+getResources().getText(R.string.myemail);
final SpannableString mes = new SpannableString(message);
Linkify.addLinks(mes, Linkify.EMAIL_ADDRESSES);
//TextView
final TextView tx1=new TextView(this);
tx1.setText(mes);
tx1.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
tx1.setAutoLinkMask(RESULT_OK);
tx1.setMovementMethod(LinkMovementMethod.getInstance());
代码示例来源:origin: stackoverflow.com
LinearLayout aboutLayout = new LinearLayout(myActivity.this);
aboutLayout.setOrientation(LinearLayout.VERTICAL);
TextView aboutText = new TextView(myActivity.this);
TextView emailLink = new TextView(myActivity.this);
emailLink.setAutoLinkMask(true);
emailLink.setText("mailto://<your email address>");
// addView is best used with setting LayoutParams.
// eg addView(view, layoutParams). The following is for simplicity.
aboutLayout.addView(aboutText);
aboutLayout.addView(emailLink);
AlertDialog aboutBox = new AlertDialog(myActivity.this);
aboutBox.setView(aboutLayout);
代码示例来源:origin: iAcn/BiliNeat
@Override
public void handleLayoutInflated(LayoutInflatedParam layoutInflatedParam) throws Throwable {
TextView textView = (TextView) layoutInflatedParam.view.findViewById(layoutInflatedParam.res
.getIdentifier("message", "id", Constant.biliPackageName));
textView.setAutoLinkMask(Linkify.WEB_URLS);
}
});
代码示例来源:origin: alt236/Bluetooth-LE-Library---Android
public static Dialog createAboutDialog(final Context context) {
final View view = LayoutInflater.from(context).inflate(R.layout.dialog_textview, null);
final TextView textView = (TextView) view.findViewById(R.id.text);
final SpannableString text = new SpannableString(context.getString(R.string.about_dialog_text));
textView.setText(text);
textView.setAutoLinkMask(Activity.RESULT_OK);
textView.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(text, Linkify.ALL);
final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int id) {
}
};
return new AlertDialog.Builder(context)
.setTitle(R.string.menu_about)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, listener)
.setView(view)
.create();
}
}
代码示例来源:origin: stackoverflow.com
TextView textView = (TextView) view.findViewById(R.id.link_tv);
textView.setLinkTextColor(getResources().getColorStateList(
R.drawable.text_selector));
textView.setLinksClickable(true);
textView.setClickable(true);
textView.setAutoLinkMask(Linkify.WEB_URLS);
textView.setText("www.dummytext.com");
代码示例来源:origin: alt236/USB-Device-Info---Android
public static Dialog createAboutDialog(final Context context) {
final View view = LayoutInflater.from(context).inflate(R.layout.dialog_textview, null);
final TextView textView = (TextView) view.findViewById(R.id.text);
final SpannableString text = new SpannableString(constructAboutText(context));
textView.setText(text);
textView.setAutoLinkMask(Activity.RESULT_OK);
textView.setMovementMethod(LinkMovementMethod.getInstance());
Linkify.addLinks(text, Linkify.ALL);
final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, final int id) {
}
};
return new AlertDialog.Builder(context)
.setTitle(R.string.label_menu_about)
.setCancelable(false)
.setPositiveButton(android.R.string.ok, listener)
.setView(view)
.create();
}
}
代码示例来源:origin: Tencent/RapidView
public void run(RapidParserObject object, Object view, Var value) {
List<String> list = RapidStringUtils.stringToList(value.getString());
int mask = 0;
for( int i = 0; i < list.size(); i++ ){
String str = list.get(i);
if( str.compareToIgnoreCase("phone") == 0 ){
mask |= Linkify.PHONE_NUMBERS;
}
else if( str.compareToIgnoreCase("web") == 0 ){
mask |= Linkify.WEB_URLS;
}
else if( str.compareToIgnoreCase("email") == 0 ){
mask |= Linkify.EMAIL_ADDRESSES;
}
else if( str.compareToIgnoreCase("map") == 0 ){
mask |= Linkify.MAP_ADDRESSES;
}
else if( str.compareToIgnoreCase("all") == 0 ){
mask |= Linkify.ALL;
}
}
((TextView)view).setAutoLinkMask(mask);
}
}
代码示例来源:origin: stackoverflow.com
tx1.setAutoLinkMask(RESULT_OK);
tx1.setMovementMethod(LinkMovementMethod.getInstance());
代码示例来源:origin: byhieg/easyweather
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
getActivity().setTheme(R.style.DayTheme);
if (MyApplication.nightMode2()) {
initNightView(R.layout.night_mode_overlay);
}
View view = inflater.inflate(R.layout.fragment_about, container, false);
TextView tv = (TextView) view.findViewById(R.id.link);
String textStr = "https://github.com/byhieg/easyweather";
tv.setAutoLinkMask(Linkify.WEB_URLS);
tv.setText(textStr);
Spannable s = (Spannable) tv.getText();
s.setSpan(new UnderlineSpan() {
@Override
public void updateDrawState(TextPaint ds) {
ds.setColor(ds.linkColor);
ds.setUnderlineText(false);
}
}, 0, textStr.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return view;
}
代码示例来源:origin: pocmo/Yaaic
/**
* Render message as text view
*
* @param context
* @return
*/
public TextView renderTextView(Context context, TextView view)
{
if (view == null) {
view = new TextView(context);
}
view.setAutoLinkMask(Linkify.ALL);
view.setLinksClickable(true);
view.setLinkTextColor(COLOR_BLUE);
view.setText(this.render(context));
view.setTextIsSelectable(true);
return view;
}
代码示例来源:origin: stackoverflow.com
preSpoilerTextView.setLinksClickable(true);
postSpoilerTextView.setLinksClickable(true);
spoilerTextView.setAutoLinkMask(Linkify.WEB_URLS);
preSpoilerTextView.setAutoLinkMask(Linkify.WEB_URLS);
postSpoilerTextView.setAutoLinkMask(Linkify.WEB_URLS);
Button spoilerButton = new Button(context);
spoilerButton.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, buttonHeight));
代码示例来源:origin: derry/delion
public PhysicalWebDiagnosticsPage(Context context) {
mContext = context;
Resources resources = mContext.getResources();
mBackgroundColor = ApiCompatibilityUtils.getColor(resources, R.color.ntp_bg);
mThemeColor = ApiCompatibilityUtils.getColor(resources, R.color.default_primary_color);
mSuccessColor = colorToHexValue(ApiCompatibilityUtils.getColor(resources,
R.color.physical_web_diags_success_color));
mFailureColor = colorToHexValue(ApiCompatibilityUtils.getColor(resources,
R.color.physical_web_diags_failure_color));
mIndeterminateColor = colorToHexValue(ApiCompatibilityUtils.getColor(resources,
R.color.physical_web_diags_indeterminate_color));
LayoutInflater inflater = LayoutInflater.from(mContext);
mPageView = inflater.inflate(R.layout.physical_web_diagnostics, null);
mLaunchButton = (Button) mPageView.findViewById(R.id.physical_web_launch);
mLaunchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mContext.startActivity(createListUrlsIntent(mContext));
}
});
mDiagnosticsText = (TextView) mPageView.findViewById(R.id.physical_web_diagnostics_text);
mDiagnosticsText.setAutoLinkMask(Linkify.WEB_URLS);
mDiagnosticsText.setText(Html.fromHtml(createDiagnosticsReportHtml()));
}
代码示例来源:origin: jelic98/dynamico
textView.setAutoLinkMask(Linkify.ALL);
}else if(mask.equalsIgnoreCase("email_addresses")) {
textView.setAutoLinkMask(Linkify.EMAIL_ADDRESSES);
}else if(mask.equalsIgnoreCase("map_addresses")) {
textView.setAutoLinkMask(Linkify.MAP_ADDRESSES);
}else if(mask.equalsIgnoreCase("phone_numbers")) {
textView.setAutoLinkMask(Linkify.PHONE_NUMBERS);
}else if(mask.equalsIgnoreCase("web_urls")) {
textView.setAutoLinkMask(Linkify.WEB_URLS);
内容来源于网络,如有侵权,请联系作者删除!