0

There is a formula written in Android documentation

 px = dp * (dpi / 160)

I have an Image whose dimensions are 35px X 35px.I have a few questions regarding this.

  1. Should i convert this image into different dp's and put it in resources.
  2. Does Android uses this formula to convert images into dp? or we need to use this formula to convert all images into DP
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
dev90
  • 7,187
  • 15
  • 80
  • 153

2 Answers2

2

Use Android Asset Studio it gives you all the needed resources made up from your image. Then you will place them into your drawable-xxx directories.

Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
1

1> Yes, you have to convert that 35x * 35x to support other devices

2> you dont need to go throught that trouble or use that formula, get it directly from available sources.

Check https://design.google.com/resources/ and http://developer.android.com/design/index.html

check previous answer https://stackoverflow.com/a/37207973/2826147

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142