how to make anchor tag in android clickable

前端 未结 2 835
执笔经年
执笔经年 2021-01-06 17:14

this is my code :

TextView aboutL1 = (TextView) findViewById(R.id.aboutL2);
    aboutL1.setText(Html.fromHtml(\"This app is open source.
The source
相关标签:
2条回答
  • 2021-01-06 17:47

    You need to call setMovementMethod:

    aboutL1.setMovementMethod(LinkMovementMethod.getInstance());
    

    (you may not even need to call Linkify.addLinks since you used Html.fromHtml, but I can't totally remember).

    0 讨论(0)
  • 2021-01-06 17:49
    aboutL1.setLinksClickable(true);
    

    in XML should be

    <TextView
        android:id="@+id/aboutL2"
        android:autoLink="web"
        android:linksClickable="true"
    />
    
    0 讨论(0)
提交回复
热议问题