I have a user icon in each row in a lift view. I'd like one corner rounded. Here is what I have and it does nothing:
 <ImageView
        android:background="@drawable/profile_widget_selector"
        android:id="@+id/ivTopUserPP"
        android:layout_width="65dp"
        android:layout_height="65dp"
        android:baselineAlignBottom="@drawable/profile_pic_shape"
        android:src="@drawable/usericon" />
profile_pic_shape.xml
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid android:color="#bbbbbb" />
    <stroke
        android:width="1dp"
        android:color="#bbb" />
    <padding
        android:bottom="1dp"
        android:left="1dp"
        android:right="1dp"
        android:top="1dp" />
    <corners android:topLeftRadius="40dp" />
</shape>
                You can use a Universal Image Loader.
https://github.com/nostra13/Android-Universal-Image-Loader.
Can be used to display bitmaps with rounded corners. Check the Link above.
In your custom adapter constructor
 File cacheDir = StorageUtils.getOwnCacheDirectory(a, "your folder");
 // Get singletone instance of ImageLoader
 imageLoader = ImageLoader.getInstance();
 // Create configuration for ImageLoader (all options are optional)
 ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(a)
      // You can pass your own memory cache implementation
     .discCache(new UnlimitedDiscCache(cacheDir)) // You can pass your own disc cache implementation
     .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
     .enableLogging()
     .build();
  // Initialize ImageLoader with created configuration. Do it once.
  imageLoader.init(config);
  options = new DisplayImageOptions.Builder()
 .showStubImage(R.drawable.stub_id)//display stub image
 .cacheInMemory()
 .cacheOnDisc()
 .displayer(new RoundedBitmapDisplayer(20)) //rounded corner bitmap
 .build();
In your getView()
 ImageView image=(ImageView)vi.findViewById(R.id.imageview); 
 imageLoader.displayImage(imageurl, image,options);//provide imageurl, imageview and options
You can configure with other options to suit your needs.
Romain guys image with rounded corners @ http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/
Found the below @ How to make an ImageView with rounded corners?
http://ruibm.com/?p=184.
public class ImageHelper {
public static Bitmap getRoundedCornerBitmap(Bitmap bitmap, int pixels) {
    Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap
            .getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(output);
    final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    final RectF rectF = new RectF(rect);
    final float roundPx = pixels;
    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);
    canvas.drawRoundRect(rectF, roundPx, roundPx, paint);
    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);
    return output;
}
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With