How to make links in a TextView clickable?

后端 未结 30 3824

I have the following TextView defined:



        
30条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 00:01

    If using XML based TextView, for your requirement you need to do just two things:

    1. Identify your link in the string, such as "this is my WebPage." You can add it in xml or in the code.

    2. In the xml that has the TextView, add these:


    android:linksClickable="true"
    
    android:autoLink="web"
    

提交回复
热议问题