Viral Viral - 2 months ago 14
Android Question

what should be button background image size to fit all device screen size

hello everyone i am newbie in android i am confusing about button background image size since couple of days i have also checked lots of SO Question and answer about that but i am not understanding what should be button background size for all screen size or that fit button or and all device density. i know that for drawable or image or bitmap i have to create ldpi,mdpi,hdpi,xhdpi etc..folder and place to appropriate folder depends on their size but what should be background image size for button to fit all scrren size.please help to solve thi issue.Thanks in Advance.


For an image to be consistent for all screen sizes, you must have multiple images - one for each screen density (Read more on screen density here). You must put each image (each with the same name) in the respective folder in Android Studio.

These folders should be called "mipmap-hdpi", "mipmap-mdpi", "mipmap-xhdpi", "mipmap-xxhdpi" under the res directory. When your resource is in each of these folders, the app will automatically use the correct one based on what type of device is being used.