ImageButton elevation issue

空扰寡人 提交于 2019-12-01 21:32:06

Add a layout_margin to your ImageButton. The elevation shadow gets clipped to the margins of the View (which defaults to zero):

<ImageButton
    android:layout_width="match_parent" android:layout_height="match_parent"
    android:layout_margin="5dp"
    android:background="@drawable/circle_shape_little"
    android:src="@drawable/ic_keyboard_arrow_right_black_24dp"
    android:elevation="3dp"/>

Alternatively, you could set the padding of the view and set clipToPadding="false", but this could lead to unexpected results depending on your layout.

Lastly, you should be using dp for everything but textSize, in which case you would use sp.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!