There is an additional property z in the view, which changes in vertical height.
Z attribute consists of two parts, elevation and translationZ
<ImageView android: android:layout_width="27dp" android:layout_height="27dp" android:elevation="3dp" android:translationZ="5dp" android:src="@drawable/shape_back" />
The relationship between the two
Both Z=elevation and translationZ can be implemented in xml and code
if (.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { (3f); } if (.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { (5f); }
The above is the implementation method of the shadow effect elevation and translationZ introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!