If you target devices before Lollipop, you can use Shadow-Layout , as it’s easy, and you can use it in different types of layouts.
Add a shadow layout to the Gradle file :
dependencies { compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.1' }
At the top of the xml layout, where you have a button, add to the beginning :
xmlns:app="http://schemas.android.com/apk/res-auto"
it will provide custom attributes.
Then you place a shadow model around you. Button :
<com.dd.ShadowLayout android:layout_marginTop="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" app:sl_shadowRadius="4dp" app:sl_shadowColor="#AA000000" app:sl_dx="0dp" app:sl_dy="0dp" app:sl_cornerRadius="56dp"> <YourButton .... /> </com.dd.ShadowLayout>
Then you can configure the app: settings according to the desired tag.
Hope this helps.
torrao Sep 18 '15 at 17:14 2015-09-18 17:14
source share