To create a stroke with shadow in android

1.1k views Asked by At

I would like to create a textview with stroke along with shadow as shown in the image, Can anyone please help me solving this issue.enter image description here

1

There are 1 answers

0
Gabriella Angelova On

Try with something like this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <layer-list>
            <item android:right="5dp" android:top="5dp">
                <shape>
                    <corners android:radius="3dp" />
                    <solid android:color="#8f0222" />
                </shape>
            </item>
            <item android:bottom="2dp" android:left="2dp">
                <shape>
                    <gradient android:angle="270" 
                        android:endColor="#E2E2E2"
                        android:startColor="#BABABA" />
                    <stroke android:width="1dp" android:color="#111111" />
                    <corners android:radius="4dp" />
                    <padding android:bottom="10dp" android:left="10dp" 
                        android:right="10dp" android:top="10dp" />
                </shape>
            </item>
        </layer-list>
    </item>

</selector>

or some of the suggestions in this SO question: Add shadow to custom shape on Android