ImageButton中的透明背景具有涟漪效应? [英] Transparent background in ImageButton with ripple effect?

查看:143
本文介绍了ImageButton中的透明背景具有涟漪效应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式删除ImageButton中的灰色背景。我尝试了很多删除它的方法,如 -

I want to programmatically remove the grey background in ImageButton. I tried many method of removing it like -

imageButton.setBackgroundDrawable(null);

但是在实现它们时,触摸时我不会对ImageButton产生连锁反应。 (触摸时不突出显示)。

but on implementing them, I don't get the ripple effect on the ImageButton on touch. (No highlighting on touch).

有没有办法删除背景但保留涟漪效果或突出显示。

Is there any way to remove the background but preserve the ripple effect or highlight.

推荐答案

如果 android:background =?attr / selectableItemBackground这比我相信这个答案可以解决你的问题:

If android:background="?attr/selectableItemBackground" this works than I believe this answer should solve your problem:

https://stackoverflow.com/a/28087443/2534007

这篇关于ImageButton中的透明背景具有涟漪效应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆