Ideas:
Add one or more layers in your own definition shape. and staggered. You can display the shadow effect. To add three-dimensional sense, the button presses, setting only one layer. we can control the direction and size of the shadows by using top, bottom, right and left four parameters.
Relationship Diagram
Here you define two shadow effects:
Res/drawable-hdpi/shadow1.xml
<?xml version= "1.0" encoding= "Utf-8"? ><selector xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item android:state_pressed=" true "> <layer-list> <item android:le ft= "4DP" android:top= "4DP" ><shape> <solid android:color= "#ff58bb52"/> <corners android:radius= "30dip"/> </shape></item> </layer-list> </i Tem> <item> <layer-list> <!--first Floor--<item android:left= "4DP" and roid:top= "4DP" ><shape> <solid android:color= "#66000000"/> <corner S android:radius= "30dip"/> <!--stroke--<stroke android:width= "1DP" Android Oid:color= "#ffffffff"/> </shape></item> <!--second Floor--<item a Ndroid:bottom= "4DP" android:right= "4DP"><shape> <solid android:color= "#ff58bb52"/> <corners Android:radi us= "30dip"/> <!--strokes--<stroke android:width= "1DP" android:color= "#ff Ffffff "/> </shape></item> </layer-list></item></selector>
/testaa/res/drawable-hdpi/shadow2.xml
<?xml version= "1.0" encoding= "Utf-8"? ><selector xmlns:android= "http://schemas.android.com/apk/res/ Android > <!--click <item android:state_pressed= "true" > <layer-list> < Item android:left= "4DP" android:top= "4DP" > <shape> <solid android:color= "#ff58bb52"/> <corners android:radius= "3DP"/> </shape> </item> </layer-list></item& Gt <!--Normal--<item> <layer-list> <!--first Floor--<item android:left= "2DP" android:top= "2DP" > <shape> <solid Android:color= "#66000000"/> <corners Android:radiu s= "3DP"/> </shape> </item> <!--second Floor--<item android:bottom= "4DP "Android:right=" 4DP > <shape> <solid Android:color= "#ff58bb52"/> <corners android:radius= "3DP"/> </shape> </item> <!--third tier--<item Android : bottom= "6DP" android:right= "6DP" > <shape> <solid Android:color= "#ffcccccc"/> <corners android:radius= "3DP" /> </shape> </item> </layer-list> </item></selector>
:
Shadow effect for graphic in Android (Shadow-effect-with-custom-shapes)