A rectangle inside another rectangle

Is it possible to create a drawable from xml, as in the picture? The first rectangle contains the second rectangle.

If yes, please explain to me how to do this.

drawable

+3
source share
1 answer

If you want simple rectangles, you can use a LayerList with two shapes as content:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#a1a1a1" /> </shape> </item> <item android:top="5dp" android:right="5dp" android:bottom="5dp" android:left="5dp"> <shape android:shape="rectangle"> <solid android:color="#f1f1f1" /> </shape> </item> </layer-list> 
+7
source

Source: https://habr.com/ru/post/1402322/


All Articles