Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw rounded corner shape mentioned below in android drawable

Tags:

android

I have tried with that code but seems not correct please help

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item>
<rotate
android:fromDegrees="45"
android:pivotX="35%"
android:pivotY="30%">
<shape>
<size android:height="5dp" android:width="5dp"/>
<corners android:radius="0.5dp" />
<solid android:color="@color/white" />
</shape>
</rotate>
</item>

enter image description here

like image 610
dev Avatar asked Dec 20 '25 00:12

dev


1 Answers

Probably it would be easier using a vector drawable:

<vector android:height="24dp" android:viewportHeight="101.01621"
    android:viewportWidth="114.45102" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#00000000"
        android:pathData="m0.421,7.319c-0.848,-4.225 2.893,-6.292 4.701,-6.534l93.265,-0.552c9.395,-0.736 15.906,2.42 15.875,15.875l-0.032,78.398c1.262,7.668 -11.009,7.894 -15.926,3.48 -17.528,-8.582 -70.939,-31.855 -92.048,-40.468 -1.899,-0.775 -3.147,-1.13 -4.14,-1.522 -2.225,-0.879 -2.097,-3.281 -1.851,-5.335z"
        android:strokeAlpha="1" android:strokeColor="#000000"
        android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
</vector>

enter image description here

If you need to make some adjustments, you shold download Inkscape (https://inkscape.org) or another svg design software and my source file (if your want) https://drive.google.com/open?id=1vY8tYcA00KAQeoulMlPmwvRWrs7EY672. Draw your shape and than export it again in svg. Once you have your file in svg format you can use vector asset tool from Android Studio. The tool generates automatically your vector xml and that you can use the vector drawable as a common drawable, for example as a source of an ImageView. Hope it helps!

like image 179
Nicola Gallazzi Avatar answered Dec 22 '25 12:12

Nicola Gallazzi