gpt4 book ai didi

Android imagebutton 波纹效果

转载 作者:太空狗 更新时间:2023-10-29 15:59:32 25 4
gpt4 key购买 nike

好吧,我知道涟漪效应只适用于 LOLLIPOP 及更高版本。但是,仍然,在设置我的 ImageButton 时,我无法获得像“常规”按钮一样工作的漂亮波纹效果,而是显示图像(和透明背景)...

我添加了 AppCompat v7 并将第二个布局放在我的 drawable/layout-v21 文件夹中,其中有以下按钮:

<ImageButton
android:id="@+id/forward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="15dp"
android:scaleType="fitCenter"
android:height="15dp"
android:padding="25dp"
style="@style/Widget.AppCompat.ImageButton"
android:src="@drawable/forwardplay" />

但是背景是灰色的,波纹(也是灰色的)无法自定义。

因此,如果我只将一个漂亮的波纹可绘制对象放入我的 drawable-v21 中,那就太好了,而且我可以从 ImageButton 的背景属性中引用它。问题是我找不到原始的 android 波纹效果(我有一个三星 S6 手机,它是三星的主题吗?)

如果有人可以分享他们的工作绘图,我会很高兴。

谢谢!

最佳答案

试试这个,绝对应该有效:

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/YOUR_BUTTON_SOURCE"
android:background="?attr/selectableItemBackgroundBorderless"
/>

关于Android imagebutton 波纹效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41165909/

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