Omar
Omar

Reputation: 8145

Where to put the different sizes of Icons?

my designer made the Icons in the 3 sizes required. 36 x 36 px 48 x 48 px 72 x 72 px

I defined the uses-sdk like this:

android:minSdkVersion="3" android:targetSdkVersion="4"

The problem is that I dont have the layout_hdpi drawable-mdpi etc.
Do I have to create them manually in the res folder? How do I define in the xml to the different icons? or does android automatically choose between the 3 different sizes?

Upvotes: 2

Views: 2163

Answers (4)

Narasimha
Narasimha

Reputation: 3766

see this developer site help full in u r project

http://developer.android.com/guide/practices/screens_support.html

Upvotes: 0

Graeme
Graeme

Reputation: 25864

You should indeed create different drawable-mdpi and drawable-hdpi yourself. The image's put inside here, when linked to, will be considered the "optimal source" for displays which are "mdpi" or "hdpi"

If you have an image in drawable-mdpi it will be used by the layout in layout-mdpi by preference but could be used by layout-hdpi as each link will try and find the most optimal source.

It does however sound like you are approaching this task from a "I've been given these size images" rather than "I need my application to display well at these different resolutions and densities".

You should read the link here: Suppoting Multiple Screens

Upvotes: 2

Paresh Mayani
Paresh Mayani

Reputation: 128448

Yes you have to create and put the belonged images inside its related folder. First go through this article: Supporting Multiple Screens

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

Upvotes: 0

Martyn
Martyn

Reputation: 16622

Yes, create these folders manually within the 'res' directory and put your assets in these newly created folders.

In Eclipse, you can right click, select New -> Other -> Android -> Android XML file then select Next. In the dialog you can specify what type of resource you want to make and below that under the "What type of resource configuration would you like?" heading you can add various different qualifiers and it'll make the folder structure for you based off the qualifiers that you choose.

In your case I'd choose a Layout resource and the Density quantifier, set to 'High Density' etc then do similar for the drawable etc

Upvotes: 0

Related Questions