Android TextView Hyperlink

前端 未结 8 745
悲&欢浪女
悲&欢浪女 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:58

    You can use like bellow..

    1. textview xml

      
      
    2. In activity

       TextView   tv_welcome_message=(TextView) findViewById(R.id.tv_welcome_message); 
       tv_welcome_message.setMovementMethod(LinkMovementMethod.getInstance());
       String text = "  Google ";
       tv_welcome_message.setText(Html.fromHtml(text));
      

提交回复
热议问题