Reputation: 211
I am using following XML as background to a Button in my app.
Can anyone guide me how to add 3D-effect(shadow) to it
XML:
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M5.7,12.5l-5.7,11.5 12,0 12,0 -5.7,-11.5c-3.2,-6.3 -6,-11.5 -6.3,-11.5 -0.3,0 -3.1,5.2 -6.3,11.5z"
android:strokeColor="#00000000"
android:fillColor="#5F9999"/>
</vector>
Upvotes: 2
Views: 2968
Reputation: 996
here is a sample of gradient that you can experiment with to give the style or 3D effect .
<?xml version="1.0" encoding="utf-8"?>
<item android:state_focused="true">
<shape android:shape="rectangle" >
<corners android:radius="0dip" />
<stroke android:width="0dip" android:color="#cb1307" />
<solid android:color="#cb1307"/>
</shape>
</item>
<item >
<shape android:shape="rectangle" >
<corners android:radius="10dip" />
<gradient android:angle="270" android:startColor="#fff" android:endColor="#89F5D7" />
</shape>
</item>
Upvotes: 1