0
私はこの画像のようなものを達成しようとしていますimage twitter tweet。ユーザーは、ハッシュタグとそのリンクを含むツイートを作成し、Twitterアプリはクリック可能なリンクに変換します。通常のTextViewはそれを達成できません。そんなことをどうやって作りますか?技術的な詳細をご記入ください。ダイナミックリンクでTwitterのようなフィード投稿ビューを作成するには?
私はこの画像のようなものを達成しようとしていますimage twitter tweet。ユーザーは、ハッシュタグとそのリンクを含むツイートを作成し、Twitterアプリはクリック可能なリンクに変換します。通常のTextViewはそれを達成できません。そんなことをどうやって作りますか?技術的な詳細をご記入ください。ダイナミックリンクでTwitterのようなフィード投稿ビューを作成するには?
のこの
ClickableSpan clickableSpan = new ClickableSpan() {
@Override
public void onClick(View textView) {
Toast.makeText(context,"clicked", Toast.LENGTH_SHORT).show();
}
};
SpannableStringBuilder builder = new SpannableStringBuilder();
SpannableString str1 = new SpannableString("click me");
str1.setSpan(clickableSpan, 0, str1.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
str1.setSpan(new ForegroundColorSpan(Color.BLUE), 0, str1.length(), 0);
str1.setSpan(new UnderlineSpan(), 0, str1.length(), 0);
SpannableString str2 = new SpannableString("demo String 2 ");
builder.append(str2);
builder.append(str1);
Textview.setText(builder, TextView.BufferType.SPANNABLE);
Textview.setMovementMethod(LinkMovementMethod.getInstance());
が重複する可能性のようなこれを達成するために、この ユーザーClickableSpanを試す[どのように私はTextViewのクリッカブルにリンクを作るのですか?](https://stackoverflow.com/questions/2734270/ i-make-links-in-a-textview-clickable) –