gpt4 book ai didi

android - ImageButton 提升问题

转载 作者:太空宇宙 更新时间:2023-11-03 12:47:56 24 4
gpt4 key购买 nike

下午好,我正在尝试创建带有阴影的 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>

但这是结果:

enter image description here

如你所见,边框被“切割”了,我不知道为什么。

有人能帮帮我吗?谢谢。

最佳答案

layout_margin 添加到您的 ImageButtonelevation 阴影被裁剪到 View 的边缘(默认为零):

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

或者,您可以设置 View 的 padding 并设置 clipToPadding="false",但这可能会导致意外结果,具体取决于您的布局。

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

关于android - ImageButton 提升问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38722902/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com