Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

image - Android : Understanding drawable folder

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The folder names need to be :

  • /drawable-ldpi For low density screens
  • /drawable-mdpi For medium density screens
  • /drawable-hdpi For high resolution screens
  • /drawable-xhdpi For extra high resolution screens

/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

  • /drawable-land-hdpi

Hope that helps


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...