Reputation: 175
I know we should use dp/sp instead of px in UI design, but the UI designer I work with just gives me his design in pixels in 1280x720. How should I convert the pixels in 1280x720 to dp/sp, and support multiple screens?
I checked the doc, 30px in 1280x720 = 15dp in xhdpi. Should I make a /values-xhdpi/dimen.xml
file in my project? And what about other resolutions? How should I deal with ldpi
, mdpi
, hdpi
, xxhdpi
, xxxhdpi
?
Also, I got the text sizes in pixels too. Do I need to do the same thing as I did with dp?
Upvotes: 2
Views: 1420
Reputation: 1379
Check this -
1) What is the difference between "px", "dp", "dip" and "sp" on Android?
2) Android screen size HDPI, LDPI, MDPI
Hope it will help :)
Upvotes: 1