Size attribute ignored in layer list

In the code below, the form occupies the entire height and width of the layer list, which means that it ignores the size attribute. (However, he listens for the top, left, and right attributes). I also tried to set the height as an attribute of the element, not a shape that had no effect.

<layer-list > <item ..... /> <item android:top="2dp" android:left="7dp" android:right="7dp"> <shape android:shape="rectangle" > <size android:height="12dp" /> <gradient android:startColor="#ddffffff" android:endColor="#00ffffff" android:angle="270" /> </shape> </item> </layer-list> 
+7
source share
1 answer

if you use an image view to set this resource as a source, then consider using centerInside

 <ImageView android:src="@drawable/sample_layer_list" android:scaleType="centerInside" android:layout_width="match_parent" android:layout_height="match_parent"/> 

In addition to this option, the rest of the option is either suitable for the entire canvas, or crop the figure.

Another option would be to resize the image itself.

One thing that I noticed is that, regardless of the size of the largest in the list of layers in the list, all the shapes inside the lists of layers become scalable for this

Hope this helps.

0
source

All Articles