I am having a Custom ListView
which contains an ImageView
and TextView
. Everything is working fine.
What I want is the image is displayed in list are in round corner. From the Webservice i get the images in rectangle shape. But i want to display it in Round corner ImageView
as below.
Can anyone show me the way how can i mask the image in round corner?
I already tried by creating the drawable file as below and applied it as src in ImageView
. But nothing working for me.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="oval" >
<solid android:color="#FFFFFF" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
<corners android:radius="5dp" />
</shape>
</item>
<item>
<shape android:shape="oval" >
<padding
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp" />
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
EDITED:
I have Applied below solution:
<FrameLayout
android:id="@+id/imagemaskframe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp" >
<ImageView
android:id="@+id/op_ivpic"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:scaleType="fitXY" />
<ImageView
android:id="@+id/iv_mask_op"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/imgmask" />
</FrameLayout>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…