Rectangle inside another rectangle
Asked Answered
D

1

6

Is it possible to create drawable from xml like on the picture? The first rectangle contains a second rectangle.

If yes, please explain to me how.

drawable

Describe answered 24/9, 2011 at 17:41 Comment(1)
what you want to do by putting rectangle inside a rectangle, do you want to perform some action other that showing this...Eutrophic
S
14

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>
Saltatorial answered 24/9, 2011 at 17:52 Comment(2)
I've known about layer-list. Thanks a lot!Describe
Do you know how do shadow effect uses drawable shapes?Describe

© 2022 - 2024 — McMap. All rights reserved.