android drawable - Is there a way to specify the width & height of a `ShapeDrawable` in xml? -


android: there way specify width & height of shapedrawable in xml? seems surprisingly difficult. using <size> child of not work, nor wrapping <shape> in layer list item , setting android:height , android:weight attributes.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >  <!--  how set shape size? top/bottom attributes allow setting size via inset parent element, isn't there way explicitly set width , height??? -->     <item         android:bottom="0dp"         android:left="0dp"         android:right="0dp"         android:top="0dp">         <shape android:shape="rectangle" >             <solid android:color="#f00" />             <stroke                 android:width="1dp"                 android:color="#0f0" />         </shape>     </item>  </layer-list> 

size , padding tags available under shape tag. please recheck code.

<item>     <shape android:shape="rectangle">         <solid android:color="#ffffff" />         <size android:height="4dp" android:width="15dp" />         <padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" />     </shape> </item> 

Comments