Zrozumienie listy <layer-list> Androida
Nie rozumiem, jak działają listy warstw. Czytałem urzędnikadokumentacja z kilkoma przykładami ale to nie działa dla mnie tak, jak oczekiwano. Chcę cztery kwadraty, które powinny być wypełnione 1dp, ale nic nie jest takie, jak oczekiwano. Oto zrzut ekranu skalowany o 500%:
(Nieprawidłowe kolory nie mają znaczenia)
Jak widać rozmiar jest całkowicie błędny i brakuje paddings. Próbowałem ustawić prawdziwe wartości, takie jak szerokość / wysokość i prawy / lewy / górny / dolny, aby mieć pewność, że android dostanie to, czego chcę.
Oto mój xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="0dp" android:left="0dp" android:bottom="0dp" android:right="0dp">
<shape android:shape="rectangle">
<size android:width="9dp"
android:height="9dp"/>
<solid android:color="#f000"/>
</shape>
</item>
<item android:top="1dp" android:left="1dp" android:bottom="5dp" android:right="5dp">
<shape android:shape="rectangle">
<size android:width="3dp"
android:height="3dp"/>
<solid android:color="#f00"/>
</shape>
</item>
<item android:top="1dp" android:left="5dp" android:bottom="5dp" android:right="1dp">
<shape android:shape="rectangle">
<size android:width="3dp"
android:height="3dp"/>
<solid android:color="#0f0"/>
</shape>
</item>
<item android:top="5dp" android:left="1dp" android:bottom="1dp" android:right="5dp">
<shape android:shape="rectangle">
<size android:width="3dp"
android:height="3dp"/>
<solid android:color="#0f0"/>
</shape>
</item>
<item android:top="5dp" android:left="5dp" android:bottom="1dp" android:right="1dp">
<shape android:shape="rectangle">
<size android:width="3dp"
android:height="3dp"/>
<solid android:color="#f00"/>
</shape>
</item>
</layer-list>