Skip to content

Commit 9ff0df4

Browse files
author
李宾
committed
回复内容超链接跳转
1 parent 30a2596 commit 9ff0df4

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

app/src/main/java/com/testerhome/nativeandroid/views/adapters/TopicReplyAdapter.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.support.v7.widget.RecyclerView;
88
import android.text.Html;
99
import android.text.TextUtils;
10+
import android.text.method.LinkMovementMethod;
1011
import android.util.Log;
1112
import android.view.LayoutInflater;
1213
import android.view.View;
@@ -71,6 +72,7 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
7172
String html = topicReplyEntity.getBody_html();
7273
// html = html.replaceAll("src=\"/photo", "src=\"" + Config.BASE_URL + "/photo");
7374
holder.topicItemBody.setText(Html.fromHtml(html, imgGetter, null));
75+
holder.topicItemBody.setMovementMethod(LinkMovementMethod.getInstance());
7476
holder.topicItemBody.getPaint().setFlags(0);
7577
holder.userAvatar.setImageURI(Uri.parse(Config.getImageUrl(topicReplyEntity.getUser().getAvatar_url())));
7678

app/src/main/res/layout/list_item_reply.xml

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
android:layout_marginRight="5dp"
4545
android:layout_marginTop="5dp"
4646
android:layout_toRightOf="@+id/id_user_avatar"
47+
android:autoLink="all"
4748
tools:text="topic content" />
4849

4950
<LinearLayout

0 commit comments

Comments
 (0)