Razgriz
Razgriz

Reputation: 7343

Android - Removing the gray border of an imagebutton programmatically

I have an application that generates imageButtons and places them in a TableRow.

However, the imageButton has a gray border along the sides that weren't on the image in the drawable folder.

How can I programmatically remove these borders? So far, the solution I've seen use the xml properties in the layout but I can't use that solution since I programmatically generate my imageButtons.

Any ideas?

Upvotes: 0

Views: 1893

Answers (2)

mohamed khalloufi
mohamed khalloufi

Reputation: 467

You can use

ImageButton btn = (ImageButton)findViewById(R.id.imagebutton);
btn.setBackground(null);

Good luck

Upvotes: 0

Razgriz
Razgriz

Reputation: 7343

Found the answer.

imageButton.setBackground(null);

Upvotes: 3

Related Questions