From 65428667d8fcc37fb480e5a03e6c8be7dd7c6fc1 Mon Sep 17 00:00:00 2001 From: Irsyad Shamsudin Date: Thu, 28 Sep 2017 10:44:35 +0800 Subject: [PATCH] Clickable URL inside the text User can now click on URL (HTML formatting) inside the ExpandableTextView without the ExpandableTextView collapsing back. --- .../square/android/expandabletextview/ExpandableTextView.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/com/ms/square/android/expandabletextview/ExpandableTextView.java b/lib/src/main/java/com/ms/square/android/expandabletextview/ExpandableTextView.java index 502fa88..40fc524 100644 --- a/lib/src/main/java/com/ms/square/android/expandabletextview/ExpandableTextView.java +++ b/lib/src/main/java/com/ms/square/android/expandabletextview/ExpandableTextView.java @@ -276,6 +276,7 @@ private void init(AttributeSet attrs) { private void findViews() { mTv = (TextView) findViewById(R.id.expandable_text); mTv.setOnClickListener(this); + mTv.setMovementMethod(LinkMovementMethod.getInstance()); mButton = (ImageButton) findViewById(R.id.expand_collapse); mButton.setImageDrawable(mCollapsed ? mExpandDrawable : mCollapseDrawable); mButton.setOnClickListener(this); @@ -361,4 +362,4 @@ public interface OnExpandStateChangeListener { */ void onExpandStateChanged(TextView textView, boolean isExpanded); } -} \ No newline at end of file +}