Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Alwin Lazar V
Alwin Lazar V
5,267 Points

Why the preview screen is not same as real device?

In weather app UI designing, when we add the degree imageView, we give 50dp for it. but it loo not perfect in that preview screen but when run it in real device it looks good. Then I put 20dp for it then it looks good in preview screen but not good in real device?

the topic cover in # Build a weather app .... and the topic # starting at the center

thanks in advance :-)

Because a dp(density independent pixel) varies by device. and while android studio attempts to show you how it will look, its only an approximation, as different devices have different screen density(s). That's sort of the point of dp's though and it's why constant testing is important. I imagine there's probably some android screen somewhere where 20dp would look fine lol..

that's probably a less than satisfactory answer, but really its just one of those things we have to accept. The tools have flaws.