简体   繁体   中英

How to cut off four corners of ImageView in android

I have to fix a rectangular image into a diamond shape transparent image and want to cut off extra four corners of rectangular image. please guide me.

create a xml file in ur drawable folder and writ the code

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">


<item>
<shape android:shape="rectangle">
    <solid android:color="@android:color/transparent" />
</shape>
</item>

<item android:left="1dp" android:right="1dp"  android:top="1dp"  
    android:bottom="1dp">
<shape android:shape="rectangle">
    <solid android:color="@android:color/transparent" />
    <stroke android:width="10dp" android:color="@android:color/white" />
 <corners
 android:bottomRightRadius="1dp"
 android:bottomLeftRadius="1dp"
 android:topLeftRadius="1dp"
 android:topRightRadius="1dp"/>
</shape>
</item>
</layer-list>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM