Android - rotate cuts off corners of shape
Heres how:
**<item android:left="5dp" android:right="5dp" android:top="5dp" android:bottom="5dp">** <rotate android:fromDegrees="45" android:toDegrees="45" > <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/sym_orange_bdfm"/> <size android:width="23dp" android:height="23dp"/> </shape> </rotate></item>
Adjust Left/Right/Top/Bottom as needed.
This was already solved here: Diamond shape xml background for android view
Just change fill color and stroke width according to your needs.
I am searching for rotate the square this help
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="20dp" android:left="20dp" android:right="20dp" android:top="20dp"> <rotate android:drawable="@color/colorAccent" android:fromDegrees="-135" android:pivotX="50%" android:pivotY="50%" android:toDegrees="-45" android:visible="true"> <shape android:shape="rectangle"> <solid android:color="@color/colorPrimaryDark" /> <corners android:radius="15dp" /> <size android:width="90dp" android:height="90dp" /> <solid android:angle="45" android:endColor="@color/colorAccent" android:gradientRadius="34" android:startColor="@color/colorPrimary" /> </shape> </rotate> </item></layer-list>
But I follow some ratio relationship for height and width 90dp and item top ,bottom,left ,right are 20dpenter image description here