dev90
dev90

Reputation: 7519

What is the best way to design Resources in Android

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

Upvotes: 0

Views: 89

Answers (2)

Amit Vaghela
Amit Vaghela

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

Alexander
Alexander

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

Related Questions