Android 如果使用通用图像加载程序应用RoundedBitmapDisplayer(),图像将消失
我正在使用通用图像加载器加载一些图像,我想使用RoundedBitmapDisplayer功能。如果不使用它,图像将完美加载,但如果我添加:Android 如果使用通用图像加载程序应用RoundedBitmapDisplayer(),图像将消失,android,imageview,universal-image-loader,Android,Imageview,Universal Image Loader,我正在使用通用图像加载器加载一些图像,我想使用RoundedBitmapDisplayer功能。如果不使用它,图像将完美加载,但如果我添加: options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.stub_image) .showImageForEmptyUri(R.drawable.image_for_empty_url) .cacheInMemory()
options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.stub_image)
.showImageForEmptyUri(R.drawable.image_for_empty_url)
.cacheInMemory()
.cacheOnDisc()
.displayer(new RoundedBitmapDisplayer(20)) //this makes the issue
.build();
整个图像消失,根本不显示。即使值为1,也会发生同样的情况。如果我省略那一行,它显示OK。我还想问一下,这是否是使用imageloader的正确方式和顺序,因此,伪代码的问题,也许回答我的主要问题更有用:
public class MyRoom{
...
DisplayImageOptions options;
ImageLoader imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration config;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
...
config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.build();
options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.stub_image)
.showImageForEmptyUri(R.drawable.image_for_empty_url)
.cacheInMemory()
.cacheOnDisc()
.displayer(new RoundedBitmapDisplayer(20)) //this makes the issue
.build();
...
}
class RoomItemAdapter extends BaseAdapter {
...
public View getView(final int position, View convertView, ViewGroup parent) {
...
imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
imageLoader.displayImage(Comment_img.get(position), viewHolder.img, options);
...
}
...
}
}
以特定值指定ImageView的布局宽度和布局高度:
<ImageView
android:id="@+id/image"
android:layout_width="50dip"
android:layout_height="50dip"
android:contentDescription="@null"/>
以特定值指定ImageView的布局宽度和布局高度:
<ImageView
android:id="@+id/image"
android:layout_width="50dip"
android:layout_height="50dip"
android:contentDescription="@null"/>
我在使用roundedbitmapdisplayer时遇到了一些问题我还尝试了其他bitmapDisplayer,比如CircleBitmapDisplayer,它也会使图像消失我的问题有点不同,如果你找到一个好的解决方案,我的图像会被修改我的interrestedI昨天将我的imageloader更新为1.9.2,在使用1.7.0版本之前,它可以正常工作。还有,如果我将RoundedBitmapStlye的值改为20,它不仅取整了imageview,还通过放大修改了图像。对我来说,这很奇怪,我在使用RoundedBitmapsDisplayer时遇到了一些问题。我还试图找到其他BitmapsDisplayer,比如CircleBitmapsDisplayer,我的问题有点不同,如果你找到一个好的解决方案,我的图像会被修改我的interrestedI昨天把我的imageloader更新到了1.9.2,之前是1.7.0版本。还有,如果我将RoundedBitmapStlye的值改为20,它不仅取整了imageview,还通过放大修改了图像。对我来说也是一样,这很奇怪。谢谢,我很快就会尝试。谢谢,我很快就会尝试。