Thursday, August 11, 2011

[android-developers] Re: Html-style links inside ListView items

...and setMovementMethod() makes the html-link work while removing the
possibility to click the rest of the list item.

I've also tried android:onClick on the TextView I use as a list item.
This works except that when clicking a link both events happen at the
same time.

On 11 Aug, 00:07, nadam <a...@anyro.se> wrote:
> Yep. Did some more testing.
>
> AutoLink works for non-html-links, but not with html-links. Clicking
> the rest of the list item doesn't work (takes you to one of the links
> instead of the click event of the list item). The html-link is
> displayed as plain text.
>
> Without autolink, the html-link looks like a link but when you click
> it nothing happens except that the click event is triggered on the
> list item.
>
> On 10 Aug, 21:39, Mark Murphy <mmur...@commonsware.com> wrote:
>
>
>
>
>
>
>
> > It worked for me on my Patchy sample, way back when. I used
> > android:autoLink in the layout XML and did not have
> > setMovementMethod().
>
> > However, I never bothered to try to get both autoLink and regular
> > onListItemClick() to work together. I would imagine the solution for
> > this is the same as the "how do I have a Button in a row and also have
> > the row be clickable", for which I think there's a solution, though I
> > don't remember it off the top of my head.
>
> > On Wed, Aug 10, 2011 at 3:32 PM, nadam <a...@anyro.se> wrote:
> > > Is this a bug in Android with no known work-around?
>
> > > On 2 Juli, 20:45, nadam <a...@anyro.se> wrote:
> > >> I've read many posts about the problem with having links insideListViewitems. The suggestions include:
>
> > >> - setText(Html.fromHtml(textWithHtmlLinks))
> > >> - setAutoLinkMask(Linkify.WEB_URLS)
> > >> - setMovementMethod(LinkMovementMethod.getInstance())
>
> > >> However, I can't get any combination of the above to work.
>
> > >> Seems like most (all?) Twitter client developers have the same
> > >> problem, since they all lack the obvious feature to be able to tap on
> > >> alink. Instead, they start a new activity or dialog where you can tap
> > >> the links.
>
> > >> Has anyone found a good solution to this problem?
>
> > >> Extra bonus points if it can be solved while still having the
> > >> possibility to have click events on the rest of the list item area.
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscribe@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android Training...At Your Office:http://commonsware.com/training

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment