I have an image with dimensions 250*70 pixels under drawable
folder (I'm just starting out in Android development, so i created drawable
folder in res
) and I have the same image with higher dimensions in drawable-large
folder; but the image is not looking as I expected.
Can anyone explain the reason behind/purpose of 3 drawable folders?
Where should I store my image so that it displays properly in both modes (landscape & portrait) and in all the mobiles (including tablets)?
I want my image to scale dynamically to the size of the device screen.
Can anyone share your views or links to search ?
A drawable resource is a general concept for a graphic that can be drawn to the screen and which you can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon . There are several different types of drawables: Bitmap File.
For current phone projects, every project should have at least 4 folders for drawables (drawable-ldpi, drawable-mdpi, drawable-hdpi and drawable-xhdpi). This allows images to be crisp and clear for all Android devices, as they won't need to be stretched.
Simply go to project Explorer and change your View from Android to project from drop Down and you are good to go. There you can simply create folder like we do in Eclipse. And in android project view it is hidden but when you switch to project. You can create folder like drawable-hdpi,drawable-xhdpi .
The folder names need to be :
/drawable should be reserved for assets that you either (1) don't care about which device or for (2) xml drawable assets
Then on top of that you can provide different resources based on configuration by using config qualifiers, you can read all about it here http://developer.android.com/guide/topics/resources/providing-resources.html
for instance, you can have high resolution assets for landscape with a folder
Hope that helps
By default Android maintain three folders for the images with different resolution reason behind it is the use or the resolution of the Android Device on which the application gonna execute.
hdpi image folder maintain images for the Android Broad Screen set or Android Phones with the Higher resolution.
ldpi for Lower images quality which supports by the earlier sets of the android
mdpi for medium images support xhdi images folder for devices with maximum resolution.
Android OS select the image it self by checking the compatible device and its resolution.
Hope it helps. Accept if you get your explanation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With