I would like to create a floating action button (to add items to the list), for example, a Google calendar, supporting compatibility with Android versions up to lollipop (up to 5.0).
I created this layout:
Activity main_activity.xml:
<LinearLayout ... > <include layout="@layout/toolbar"/> <RelativeLayout ... > <ImageButton style="@style/AppTheme" android:layout_width="60dp" android:layout_height="60dp" android:text="New Button" android:id="@+id/button" android:src="@drawable/ic_fab" android:background="@drawable/fab" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginBottom="24dp" android:layout_marginRight="24dp"/> </RelativeLayout> </LinearLayout>
Drawable fab.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="#ffa48bc0"/> </shape>
Style styles.xml
<resources> <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">#ff1d79b1</item> <item name="colorPrimaryDark">#ff084d95</item> </style> </resources>
The result is similar, but there is no shading characteristic of material design:
Button floating action in the calendar:

My floating button application:

How to add shading to my button?
I already used attribute elevation but not working
android xml
FirestormXYZ Nov 16 '14 at 23:14 2014-11-16 23:14
source share