If you want the background to exactly fit your TextView size without stretching, and this text fits inside, you must use a 9-patch image or you need to set a fixed size equal to the size of the image. There are no other solutions.
Consider also that padding reduces only the area of โโthe text field (the background does not shrink), and margin leaves space outside the TextView field.
So, if the background image (image_width, image_height) and you want to leave the registration inside the TextView without stretching the background and without using the 9-patch image, you should set the fixed size in the TextView to (image_width+paddingLeft+paddingRight, image_height+paddingTop+paddingBottom) .
source share