0
我想打开http://www.google.com时点击到textview链接。但它启动浏览器,但在地址栏显示wwww.google.com%27,它会产生错误。请提供解决方案。在textView链接中打开网站
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView=(TextView)findViewById(R.id.textView1);
textView.setClickable(true);
textView.setMovementMethod(LinkMovementMethod.getInstance());
String text="<a 'href=http://www.google.com'> Click to open Google!!! </a>";
textView.setText(Html.fromHtml(text));
嗨我是初学者,不知道如何对文本进行编码/解码。您能否解释 – user2478122
尝试类似这样的'Html.fromHtml(“<![CDATA [ Click to open Google!!!]]>”);' –
我在www.google.com上删除了撇号,现在可以使用了。 – user2478122