I just have this question cus i have 3 folders and everyone else should also have when they create apps and i am now trying to update my app with some nice graphics for some buttons and such.. And now i wonder the following.
I have some button i want to add a picture to.. But there is three folders Drawable-hdpi,开发者_如何学Python mdpi and ldpi, The buttons im creating need different sizes for each folder correct so when u use for example small screen phone the buttons wont be too big.. And the screen is big phone the buttons wont be too small.. Correct?
And now i wonder what kind of width and height should i have on theese pictures for each folder here?
Please help me. Thanks!
You can find a very detailled explanation in the Android Development Guide: http://developer.android.com/guide/practices/screens_support.html
Your "normal" sized image should be optimized for mdpi (160dpi), while the ldpi image is 25% smaller (120dpi) and the hdpi image is 50% larger (240dpi).
Android will then select the best-matching ressource and scale it up/down if necessary. So even if you only have a hdpi image (and no ldpi/mdpi), Android will scale it down on devices with low ressolution displays and it should look passable.
Do you ever use 9patch images? A lot of times with buttons you can use just one 9patch image for any resolution and they tend to look fine. I usually create a folder just called "drawable" and put those kinds of things in there. Just a thought.
you can put everything on a drawable/ folder and forget about -hdpi,-ldpi and -mdpi an android will use those resource for everything, if you instead put different images on those folders you can be more selective on what resources you use according to the device resolution.
Also check http://developer.android.com/guide/practices/screens_support.html and
http://developer.android.com/guide/topics/resources/providing-resources.html
精彩评论