To use android:elevation
, like any other Android 5.0 API, you must compile it under Android 5.0 (API 21). This does not mean that you need to change the target SDK level or the minimum SDK level.
Note. Your XML file may still give a warning that android:elevation
only works on Android 5.0 or later. This warning just tells you that previous versions of Android will not have a height shadow on a button with a floating action. However, this does not cause an error - previous versions of Android ignore XML attributes that they do not understand.
source share