image = BitmapFactory.decodeResource(res, R.drawable.image);
button = new ImageButton(this);
button.setImageBitmap(image);
I want to remove padding between image and border of button. How can I do that?
You can use setPadding()
to try to remove the space between the image and the border.
button.setPadding(0, 0, 0, 0);
Otherwise I suggest using a regular ImageView
with an OnClickListener
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With