By chance, when Android 5.0 uses ImageButton as follows, it will have its own shadow,
<LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:tools= "Http://schemas.android.com/tools"Xmlns:app= "Http://schemas.android.com/apk/res-auto"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:gravity= "Center"android:orientation= "vertical" > <ImageButtonAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/ic_launcher" /></LinearLayout>
View Code
The solution is to change android:src= "@drawable/ic_launcher" to android:background= "@drawable/ic_launcher" effect
The reason is that ImageButton inherits ImageView and loads a default style:
Public ImageButton (context context, AttributeSet Attrs) {
This (context, attrs, Com.android.internal.r.attr.imagebuttonstyle);
}
Android 5.0 ImageButton self-shadowing solution