点击TextView浏览器打开指定网页

时间:2021-11-21 13:40:38

直接上代码:

     /**
* 点击跳转到版权页面
*/
private void getCopyRight() {
// TODO Auto-generated method stub
TextView bottomTextView = (TextView) findViewById(R.id.tv_bottom);
String html = "<a href=\"http://www.newbiefly.com\">©2016菜鸟要飞版权所有</a>";
bottomTextView.setMovementMethod(LinkMovementMethod.getInstance());
CharSequence charSequence = Html.fromHtml(html);
bottomTextView.setText(charSequence);
}

intent启动浏览器打开网页

         mButton3.setOnClickListener(new OnClickListener() {

             @Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.baidu.com"));
startActivity(intent);
}
});

-

==