0

I have a LinearLayout/Scrollview/LinearLayout in which I need two links.

first is a regular TextView - that works fine. SECOND TextView is in a RelativeLayout with an ImageView left from it, that's not working. (LinearLayout/Scrollview/LinearLayout/RelativeLayout ImageView TextView* )

TextView first =  (TextView) v.findViewById(R.id.first_tv);
TextView second = (TextView) v.findViewById(R.id.second_tv);

first.setText(Html.fromHtml(getString(R.string.url_first)));
Linkify.addLinks(first, Linkify.ALL);

second.setText(Html.fromHtml(getString(R.string.url_second)));
Linkify.addLinks(second, Linkify.ALL);

first textview click works. Why does the second textview look like it's a link but it's not opening the browser on click?

Michael D.
  • 1,795
  • 2
  • 18
  • 25
  • Something is capturing the click event. Perhaps the image's dimensions are over the text view (but not the drawn area.) I'd recommend turning on the "Draw Layout Bounds" option in the developer options of your test device and see what's overlaid on-top of it. – Slynk Jan 17 '14 at 13:46
  • It looks abolutely fine from the code. As both textbox are identical. Have you made any mistake in R.id.second_tv string? You can also check layout bounds as suggested by @Slynk – Bipin Bhandari Jan 17 '14 at 13:51
  • I removed the ImageView and have changed the 2nd tv to use the 1st_url. Added android:clickable="true" and it's still not working. It must be the RelativeLayout I guess. – Michael D. Jan 17 '14 at 14:04

1 Answers1

0

add

second.setMovementMethod(LinkMovementMethod.getInstance());
Michael D.
  • 1,795
  • 2
  • 18
  • 25