Part of the problem is that the individual elements in the layer list are scaled to the total size of the extracted. As described in the docs , you can get around this by wrapping small squares in a bitmap
drawable. Something like this might work. First, define the main shape as a separate drawable:
range hood /square.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <stroke android:width="1px" android:color="#fff" /> <solid android:color="#00FF0000" /> <corners android:radius="3dp" /> <size android:width="10dp" android:height="10dp"/> </shape>
Strike>
(EDIT: It would be nice if you could do the above, but unfortunately, as @Someone Somewhere noted in the comment, you cannot reference the curly drawings from the <bitmap>
. To create a square like an actual bitmap so that everything the rest worked.)
Then you can define a list of layers that will not scale individual squares:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:left="20dp" android:top="20dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="35dp" android:top="20dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="50dp" android:top="20dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="20dp" android:top="35dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="35dp" android:top="35dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="50dp" android:top="35dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="20dp" android:top="50dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="35dp" android:top="50dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> <item android:left="50dp" android:top="50dp"> <bitmap android:src="@drawable/square" android:gravity="top|left" /> </item> </layer-list>
I have not tested this, so it may be a bit, but you should be able to tweak it to get what you want. It is important to get rid of scaling.
source share