Reputation: 7519
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.
- Should i convert this image into different
dp's
and put it in resources.- Does Android uses this formula to convert images into
dp
? or we need to use this formula to convert all images intoDP
Upvotes: 0
Views: 89
Reputation: 22945
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
Upvotes: 1
Reputation: 48252
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.
Upvotes: 2