1

I am currently lazy loading a set of images to my application in android. When I finish loading them,i want to apply a mask(so I can have round corners on them).How can I achieve this effect?(i am not using xml shapes for the round corners, since I want the corners anti-aliased).

Thanks

user1437481
  • 470
  • 1
  • 9
  • 30

1 Answers1

1

There are several questions. Please check these out:
• How to make an ImageView with rounded corners?
• Creating ImageView with round corners
• https://groups.google.com/forum/?fromgroups=#!topic/android-developers/4j7SLzAGhMk

Articles on creating custom views
• http://developer.android.com/training/custom-views/index.html • http://developer.android.com/guide/topics/ui/custom-components.html

Community
  • 1
  • 1
Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
  • The thing is i need it set to an imageview, not to a bitmap – user1437481 Oct 17 '12 at 15:58
  • Either way it doesn't make much difference. You can create a RoundedImageView, and use the same code inside the onDraw() method. If your are using drawables (These are usually of the BitmapDrawable type if you load from image files) call the getBitmap() method to obtain a Bitmap. – Ragunath Jawahar Oct 17 '12 at 16:07
  • could you give me an example please? i am not understanding very well what you mean – user1437481 Oct 17 '12 at 19:39
  • I think I understand now. But I am lazy loading the images,so when the ondraw is called the drawable is always null – user1437481 Oct 19 '12 at 07:38
  • Doesn't matter, just set the Image once it is available. – Ragunath Jawahar Oct 19 '12 at 10:41
  • 10-19 14:35:23.569: E/AndroidRuntime(6696): FATAL EXCEPTION: main 10-19 14:35:23.569: E/AndroidRuntime(6696): java.lang.ClassCastException: com.koushikdutta.urlimageviewhelper.UrlImageViewHelper$ZombieDrawable cannot be cast to android.graphics.drawable.BitmapDrawable 10-19 14:35:23.569: E/AndroidRuntime(6696): at com.koushikdutta.test.widget.RoundSexta.onDraw(RoundSexta.java:39) i always get this error – user1437481 Oct 19 '12 at 13:36