ImageView的自动链接 [英] imageview autolink
本文介绍了ImageView的自动链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新来的机器人。从XML我检索它以超链接的图像刻()
当有click事件图片我想页面重定向到该超链接。怎么办呢? (以TextView中的自动连接类似),如何实现它?
I am new to android. From xml I retrieved image which is inscribed in hyperlink () When there is click event on image I want page to redirect to that hyperlink. How to do so? (Similar to autolink of textview) how to implement it ?
推荐答案
在您的活动//获取的ImageView
//in your activity get the imageview
ImageView imgLink=(ImageView)findViewById(R.id.weblink);
imgLink.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent link=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(link);
}
});
这篇关于ImageView的自动链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文