You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.
packagecom.taobao.weex.adapter;
importandroid.widget.ImageView;
importcom.taobao.weex.common.WXImageStrategy;
importcom.taobao.weex.dom.WXImageQuality;
/** * Interface for ImageLoader. This interface works as an adapter for various image library. */publicinterfaceIWXImgLoaderAdapter {
voidsetImage(Stringurl, ImageViewview, WXImageQualityquality, WXImageStrategyquality);
}
publicenumWXImageQuality {
ORIGINAL,
LOW,
NORMAL,
HIGH
}
Strategy这个setImage参数主要是对图片做一些剪裁和blur
publicclassWXImageStrategy {
/** * Whether to clip image. The default value is false. */publicbooleanisClipping;
/** * Whether to sharp the image. The default is false. */publicbooleanisSharpen;
/** * The blur radius of the image. [0,10],0 means no blur. * */publicintblurRadius;
publicStringplaceHolder;
publicImageListenergetImageListener() {
returnimageListener;
}
publicvoidsetImageListener(ImageListenerimageListener) {
this.imageListener = imageListener;
}
ImageListenerimageListener;
publicinterfaceImageListener{
publicvoidonImageFinish(Stringurl,ImageViewimageView,booleanresult,Mapextra);
}
}
新手问题 如何加载本地图片呀?
来看看官方让我们嵌入weex的时候,怎么指导的
这是weex SDK(android) 里类的代码:
我们关注四个参数url-view-quality-quality
再来看看我们weex内建的组件的属性:
那我们看看原生端,WXImage这个类的核心部分
同样的还有:
这里@WXComponentProp是weex开发自定义组件的注解,后续会讲怎么自定义component,@WXComponentProp就是起到获取标签属性的作用。
好了我们回到ImageAdapter
这里我们以Picasso为例子:
在setImage方法里,我们可以对url做一些处理,Picasso能接受哪些路径参数呢?
这里给个vue方面的例子:
总结下图片的加载,就是实现下setImage方法,不知道怎么加载本地图的同学👨🎓肯定是不知道:src的属性路径字符串怎么写,这里就需要你看看Picasso(安卓)的使用说明,iOS我不清楚不过应该是类似的,主要问题是路径字符串格式大家不清楚,总之还是蛮简单的。希望对你有帮助。
The text was updated successfully, but these errors were encountered: