因此,每当我多次使用相同的图像时,它就会被取消。所以我希望你们能帮助我,我想用图像作为标记图标
这是我的代码:
String uri = "http://192.168.2.8:3000" + articlesArray.getJSONObject(i).getString("icon");
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.loadImage(uri, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
Log.e("tag", "onLoadingStarted");
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
Log.e("tag", "onLoadingFailed");
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
marker.setIcon(BitmapDescriptorFactory.fromBitmap(loadedImage));
Log.e("tag", "onLoadingComplete");
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
Log.e("tag", "onLoadingCancelled");
}
});
答案 0 :(得分:0)
我解决了我的问题。对于那些仍在寻找答案的人来说,这就是我所做的:
String uri = "http://192.168.2.8:3000" + articlesArray.getJSONObject(i).getString("icon");
ImageLoader imageLoader = ImageLoader.getInstance();
ImageSize targetSize = new ImageSize(37, 32);
ImageAware imageAware = new NonViewAware(targetSize, ViewScaleType.CROP);
imageLoader.displayImage(uri,imageAware, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String s, View view) {
Log.e("tag", "onLoadingStarted");
}
@Override
public void onLoadingFailed(String s, View view, FailReason failReason) {
Log.e("tag", "onLoadingFailed");
}
@Override
public void onLoadingComplete(String s, View view, Bitmap bitmap) {
Log.e("tag", "onLoadingComplete");
marker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmap));
}
@Override
public void onLoadingCancelled(String s, View view) {
Log.e("tag", "onLoadingCancelled");
}
});