1 | initial version |
To create a customized switch background that resembles a shadow in Android, you can try the following steps:
Here's an example of what the "switchbackgroundshadow.xml" file might look like:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<solid android:color="#EDEDED" />
<stroke android:color="#EDEDED" android:width="2dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="20dp" />
<gradient
android:startColor="@android:color/transparent"
android:endColor="@android:color/transparent"
android:angle="90" />
</shape>
</item>
</layer-list>
This should create a switch background that has a subtle shadow effect, with a solid-colored rectangle and a transparent rectangle sitting on top of it. The stroke element creates a border around the entire shape to give it some extra depth.