'How to verify (digital) pixel-perfect development in Android?

tl;dr How do I convert pixel measurements on one device to pixel measurements on another?

I've designed an Android app with all the screens measuring 720x1280 px. I've assumed this is at 2.0 xhdpi meaning digital-pixel dimensions of 360x640 dp.

Now in QA I've found a few inconsistencies on my Nexus 5x, taken screenshots, and pulled them into Photoshop to confirm/measure the errors. The Nexus 5x is 1080x1920 px, but is at 2.6 xxhdpi which converts to 411x731 dp.

Won't just a simple scale fail?

It's not as simple as pulling the Nexus (1080 width) screenshots into Photoshop and scaling them to width 720, right? That doesn't account for pixel densities.

Said another way. If a square is 100px (50dp) on my @2x design, how large should I expect it to be on the Nexus screenshot?

Helpful links



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source