android-ImageButton高程问题

android-ImageButton高程问题,第1张

概述下午好,我试图用阴影创建enImageButton.要做到这一点:<LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center_vertical"android:padding="5sp">

下午好,我试图用阴影创建en Imagebutton.

要做到这一点 :

<linearLayout    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:layout_gravity="center_vertical"    androID:padding="5sp">    <Imagebutton        androID:layout_wIDth="match_parent"        androID:layout_height="match_parent"        androID:background="@drawable/circle_shape_little"        androID:src="@drawable/ic_keyboard_arrow_right_black_24dp"        androID:elevation="3sp"/></linearLayout>

但这是结果:

如您所见,边界是“切割”的,我不知道为什么.

有人可以帮助我吗?谢谢.

解决方法:

将layout_margin添加到您的Imagebutton.高程阴影被裁剪到视图的边缘(默认为零):

<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"/>

另外,您可以设置视图的填充并设置clipTopadding =“ false”,但这可能会导致意外结果,具体取决于您的布局.

最后,您should be将dp用于除textSize之外的所有内容,在这种情况下,您将使用sp.

总结

以上是内存溢出为你收集整理的android-ImageButton高程问题全部内容,希望文章能够帮你解决android-ImageButton高程问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1094853.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存