Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links are not clickable in ExpandableTextView #51

Open
naveenvenkannagari opened this issue Jul 3, 2017 · 7 comments
Open

Links are not clickable in ExpandableTextView #51

naveenvenkannagari opened this issue Jul 3, 2017 · 7 comments

Comments

@naveenvenkannagari
Copy link

naveenvenkannagari commented Jul 3, 2017

Setting HTML text as a part of ExpandableTextView using (Html.fromHtml(String, int)) . when there are hyperlinks as a part of HTML content its display as a link. the clicking of that link will collapse the view instead of opening that in browser.
Is the textview which is wrapped in ExpandableTextView (LinearLayout) is
textview.setMovementMethod(LinkMovementMethod.getInstance()); ??

@masamiYaaaa
Copy link

As we can

@ShuichiSyad
Copy link

ShuichiSyad commented Sep 28, 2017

@naveenvenkannagari The links are clickable..
To create an expendableTextView, we have to make a TextView inside it with id of "expandable_text".
Just declare the "expandable_text" in your java class

TextView expandable_text = (TextView) findViewById(R.id.expandable_text);

then set the LinkMovementMethod to it

expandable_text.setMovementMethod(LinkMovementMethod.getInstance());

Make sure theres NO android:autoLink="web" on your layout because it will render your text wrong

@zdunex25
Copy link

If I use more than one ExpandableTextView (as in list view) it only work for first entry, moreover we are not able to rename IDs (like expandable_text), so I cannot make unique IDs for another entries.

@pmbranco
Copy link

pmbranco commented Jul 2, 2021

Tried this but with no success. Can someone provide a way to implement it? The expandable textview closes when I click on the link inside the expanded textview.

@zdunex25
Copy link

zdunex25 commented Jul 3, 2021

Tried this but with no success. Can someone provide a way to implement it? The expandable textview closes when I click on the link inside the expanded textview.

I had to import ExpandableTextView class and do some corrections in both ExpandListener and CollapseListener :
contentText.setText(Html.fromHtml(text)); contentText.setMovementMethod(LinkMovementMethod.getInstance());
in order to make links clickable.

Then in layout.xml i used: com.my.packagename.ExpandableTextView to load edited class instead of original one.

@pmbranco
Copy link

pmbranco commented Jul 5, 2021

I am doing precisely that... going to recheck it and let you know. Thanks for helping me out!

@pmbranco
Copy link

pmbranco commented Jul 5, 2021

I can do it on the textview while not expanded. But it didn´t work on the expanded text. Needed to also add to the xml element:
android:linksClickable="true"
android:autoLink="all"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants