Android TextView Hyperlink

前端 未结 8 747
悲&欢浪女
悲&欢浪女 2021-02-05 03:45

I\'m implementing a TextView with a string containing two hyperlinks as below but the links are not opening a new browser window:



        
8条回答
  •  滥情空心
    2021-02-05 03:49

    MainActivity.java

     TextView t2 = (TextView) findViewById(R.id.text2);
        t2.setMovementMethod(LinkMovementMethod.getInstance());
    

    I removed most of the attributes on my TextView to match what was in the demo

    
    

    Don't forget to remove autoLink="web" if you are calling setMovementMethod()

提交回复
热议问题