我可以使用 layout.xml
设置 ImageButton 背景透明:
android:background="@android:color/transparent"
如何使用 java 代码完成相同的事情?
像 ib.setBackgroundColor(???);
最佳答案
这是您只需将背景颜色设置为透明的简单方法
ImageButton btn=(ImageButton)findViewById(R.id.ImageButton01);
btn.setBackgroundColor(Color.TRANSPARENT);
关于android - 如何在代码中为图像按钮设置透明背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4710025/