Android - rotation disables shape corners

I want to make a diamond as a resource file, so I rotate the square to do this. The problem is that the corners seem to be cropped, instead a hexagon is formed. Just like a note, I would like to stretch it vertically, if possible.

<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <rotate android:fromDegrees="45" android:pivotX="50%" android:pivotY="50%" android:toDegrees="45" > <shape android:shape="rectangle"> <size android:height="40dp" android:width="40dp" /> <solid android:color="@color/level_1_color" /> </shape> </rotate> </item> 

enter image description here

+7
android xml android-xml graphics
Oct 26 '14 at 19:22
source share
1 answer

Here's 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.

+1
Dec 09 '15 at 7:46
source share



All Articles