Shape Drawable Size not working
android, drawable, shapedrawable, xml-layout
Solution
For me, setting the gravity of the item to "center" solved the issue. For example:
<item android:id="@android:id/progress" android:gravity="center">
<clip>
<shape>
<size android:height="2dp"/>
<solid android:color="@color/my_color"/>
</shape>
</clip>
</item>
Problem
I have a very simple shape that I want to set the width of: ``` <shape android:shape="rectangle"> <solid android:color="@color/orange"/> <size android:width="2dp"/> </shape> ``` However, when I assign this to the background of a EditText it just shows an orange background instead of a rectangle of width 2dp. Why isn't setting the size working? I want to create a transparent drawable with a orange rectangle on the left side. I also have this wrapped in a selector: ``` <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true"> <shape android:shape="rectangle"> <solid android:color="@color/orange"/> <size android:width="2dp" android:height="6dp"/> </shape> </item> <item> <shape android:shape="rectangle"> <solid android:color="@android:color/transparent"/> </shape> </item> </selector> ``` I've tried adding height just to see if it would change the size. It doesn't. It's like its completely ignoring the size. WTF?