2

The problem is as follows: I need to make in app widget some actionbar like this:

enter image description here

For this I use layer-list with shape.

<?xml version="1.0" encoding="utf-8"?>

<!-- Bottom 2dp Shadow -->

<item>
    <shape  android:shape="rectangle">
        <solid android:color="#027668"/>
        <corners android:radius="12dp"/>
    </shape>
</item>

<!-- White Top color -->
<item android:bottom="4dp">
    <shape  android:shape="rectangle">
        <solid android:color="#20a18b" />
        <corners android:radius="7dp" />
    </shape>

</item>

And I get some view:

enter image description here

but, I cant do some around shadow like on first image in this post.

How to do that?

Maximillian Laumeister
  • 19,884
  • 8
  • 59
  • 78

1 Answers1

3

Here you go:

Change your drawable background to:

<?xml version="1.0" encoding="utf-8"?><!-- Bottom 2dp Shadow -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid android:color="#027668" />
            <corners android:radius="12dp" />
        </shape>
    </item>

    <!-- White Top color -->
    <item android:bottom="4dp">
        <shape android:shape="rectangle">
            <solid android:color="#20a18b" />
            <corners android:radius="7dp" />
            <stroke
                android:width="2dp"
                android:color="#027668" />
        </shape>

    </item>
</layer-list>

The results

enter image description here

William Kinaan
  • 28,059
  • 20
  • 85
  • 118