且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何以编程方式删除 ImageButton 的填充?

更新时间:2023-02-12 19:19:41

您可以使用 setPadding() 尝试去除图像和边框之间的空间.

You can use setPadding() to try to remove the space between the image and the border.

button.setPadding(0, 0, 0, 0);

否则我建议使用带有 OnClickListener 的常规 ImageView.

Otherwise I suggest using a regular ImageView with an OnClickListener.