Linkify in android TextView

前端 未结 4 1551
挽巷
挽巷 2021-01-13 03:28

I have a text view with text\" This is a product developed by XYZ. For more queries, mail us at info@abc.com. And I have linkified \"info@abc.com\". But the problem is, when

相关标签:
4条回答
  • 2021-01-13 04:08

    the best way I used and it always worked for me

     android:autoLink="web"
    

    Hope this will help you all.

    Thanks, rohit

    0 讨论(0)
  • 2021-01-13 04:08

    Try using HTML formatting i.e. anchor tag for the link.

    0 讨论(0)
  • 2021-01-13 04:09

    I had problems with automatic links, so I turned it off and instead I am using html formating of the text plus this code:

    TextView textView = (TextView) findViewById(R.id.TextBox);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setText(Html.fromHtml(strText));
    

    An email link goes <a href="mailto:my@email.com">my@email.com</a>

    0 讨论(0)
  • 2021-01-13 04:10

    Method using Linkify Class:

    myTextView.setAutoLinkMask(Linkify.EMAIL_ADDRESSES);
    myTextView.setLinksClickable(true);
    
    0 讨论(0)
提交回复
热议问题