2

I have an ImageView which shows user's profile photo and I want it to have this type of frame: ImageView with rounded corners

I searched for "rounded ImageView" and "ImageView with rounded corners" and almost looked through all the Q/A in SO but couldn't find what I was looking for. Those question and answers were about this type of frame and I don't want it:

SO answer about rounded ImageView which I don't want,

Recipe for making a rounded ImageView written by Google dev.

I don't want any straight edge-lines of the ImageView, I want it to have smooth-curvy Image frame that is used in Samsung Icons (squircle shape). I also looked through bunch of GitHub repos, couldn't find any that matched my description.

So, is there a way to do it in code, or some repos that I can use like CircularImageView?

P.S. I am a novice in this sphere, so simple explanations are greatly appreciated.

I also tried to use CardView as a mask for ImageView but couldn't get the desired look.

amira
  • 416
  • 1
  • 7
  • 24
  • 3
    The shape itself is called a squircle. This shows you how you can override a View and draw a squircle on the Canvas https://stackoverflow.com/questions/50206406/drawing-a-squircle-shape-on-canvas-android. – TheWanderer Nov 20 '18 at 20:20
  • Whoa, @TheWanderer you are the man, pff "squircle" eh :) Checking it out... – amira Nov 20 '18 at 20:27
  • 1
    create a custom class as per the shape you required which extends the imageview and use that class in your layout file as imageview.. that will do the thing. – Masoom Badi Nov 20 '18 at 22:48

0 Answers0