I am having this problem and I know it's common, the problem is that I have already applied the code to draw, here. Now, since my ImageView
has set width and height which is 50dp
, the rounded corner is not achieved.
So I used the xml alternative, here it is:
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="1dp"
android:color="#999999" />
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp"/>
<solid android:color="#ffffff" />
<corners android:radius="15dp" />
</shape>
I made this as background of the ImageView, the problem now is that the only affected of the round corner is the ImageView itself and not its content image. The image's normal (rectangle or sharp) edge still overlapped its container which is the ImageView. I also set this android:scaleType="centerCrop"
in my ImageView
.
I am now confused, so setting the ImageView's width and height forfeits the effect of the rounded corner? What should I do?