Developer
Developer

Reputation: 49

Android image sizes best practises

I read this tutorial http://developer.android.com/guide/practices/screens_support.html#DeclaringTabletLayouts ,but I don't understand all examples.I want to create an image in my android application ,but I don't know how much pixels should I use,for example in drawable-ldpi , drawable-mdpi , drawable-hdpi and drawable-hxdpi which sizes I should use ? What means 3:4:6:8 sizes ?Is this for images or for application Icon ?

Upvotes: 0

Views: 243

Answers (1)

Yoann Hercouet
Yoann Hercouet

Reputation: 17996

Have a look to the Android documentation:

http://developer.android.com/design/style/iconography.html

They explain what you are asking at the beginning, but I advise you to read the whole article.

If you want to generate an icon set with all the different dimensions wanted, you can use a tool named Icon Generator that you can find here:

http://android-ui-utils.googlecode.com/hg/asset-studio/dist/icons-launcher.html

This tool is also available if you are using Eclipse to develop:

  • Right-click on the Android project
  • New --> Other ...
  • Then open the Android folder and select "Android Icon Set"

Then just follow the steps to create the icons wanted, they will be automatically added in your project in your "res" folder.

Concerning the image sizes, I advise you to use "dp":

The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

Several links on the official doc:

http://developer.android.com/guide/practices/screens_support.html http://developer.android.com/training/multiscreen/screendensities.html http://developer.android.com/design/style/metrics-grids.html

Upvotes: 1

Related Questions