开发者

Rectangle inside another rectangle

开发者 https://www.devze.com 2023-04-08 17:06 出处:网络
Is it possible to create drawable from xml like on the picture? The f开发者_JAVA百科irst rectangle contains a second rectangle.

Is it possible to create drawable from xml like on the picture? The f开发者_JAVA百科irst rectangle contains a second rectangle.

If yes, please explain to me how.

Rectangle inside another rectangle


If you want simple rectangles you could 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消