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.
Asked
Active
Viewed 395 times
1
-
1What do you mean "to fit all screen size"? What kind of button is it? What are you doing now? – Karakuri Jun 23 '16 at 14:24
-
simple button or imagebutton that i have to set its background image – Viral Jun 23 '16 at 14:31
-
so what would be the background image size for button so its fit to my button size that will be consistent to all screen device size. – Viral Jun 23 '16 at 14:34
-
any idea about it? – Viral Jun 23 '16 at 18:08
-
Maybe you should post a specific example instead, because I don't think anyone understands what you are asking if it's not a question about density qualifiers on resources. – Karakuri Jun 23 '16 at 19:56
-
sir, it is simple that i want to know the background image size which we usually set to background of button. so, what should be background image size for button that fit to all device screen density – Viral Jun 24 '16 at 04:42
1 Answers
0
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.
-
my question is regarding button background image size. so, what should be image size i have to keep in these folder like mdpi,hdpi,xhdpi,xxhdpi,xxxhdpi i know for drawable size to fit all screen size to generate and place to these are folder mdpi,hdpi etc.. but what should be size for background image of button. i hope you understand my question. – Viral Jun 23 '16 at 17:05