You can resize the image to fit the button, use the getHeight()
and getWidth()
methods to get the size of the button and use the following function to resize the image for the button:
Resize a bitmap:
public Bitmap getResizedBitmap(Bitmap bm, int newHeight, int newWidth) { int width = bm.getWidth(); int height = bm.getHeight(); float scaleWidth = ((float) newWidth) / width; float scaleHeight = ((float) newHeight) / height;
Now use this resize for your button. Link
source share