ImageView rounded corners

后端 未结 17 2052
长发绾君心
长发绾君心 2020-11-27 15:33

I wanted image to have rounded corners. I implement this xml code and use this in my image view. but image overlap the shape. I am downloading the image through async task.<

17条回答
  •  伪装坚强ぢ
    2020-11-27 16:33

    I use Universal Image loader library to download and round the corners of image, and it worked for me.

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(thisContext)
                // You can pass your own memory cache implementation
               .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
               .build();
    
    DisplayImageOptions options = new DisplayImageOptions.Builder()
                .displayer(new RoundedBitmapDisplayer(10)) //rounded corner bitmap
                .cacheInMemory(true)
                .cacheOnDisc(true)
                .build();
    
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
    imageLoader.displayImage(image_url,image_view, options );
    

提交回复
热议问题