1 添加图片利用ImageSpan来处理,也可以自定义控件继承ImageSpan,添加自定义属性,比如:imageUri,index这样在 后面来处理点击事件时,可以直接获取到uri来做相应的处理:获取原图,做成viewPager效果等…
如下是例子代码,可以参考:
一.MyImageSpan
public class MyImageSpan extends ImageSpan
{
public int index; //图片的下标
public String path; //图片的url地址
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public MyImageSpan(Drawable d) {
super(d);
}
public MyImageSpan(Context context, Bitmap b) {
super(context, b);
}
public MyImageSpan(Drawable d, int verticalAlignment) {
super(d, verticalAlignment);
}
public MyImageSpan(Drawable d, String source) {
super(d, source);
}
public MyImageSpan(Context context, Uri uri) {
super(context, uri);
}
public MyImageSpan(Context context, int resourceId) {
super(context, resourceId);
}
public MyImageSpan(Context context, Bitmap b, int verticalAlignment) {
super(context, b, verticalAlignment);
}
public MyImageSpan(Drawable d, String source, int verticalAlignment) {
super