i'm having a little trouble with my android app and different screen sizes. I want my game to look the same on every screen but i uses static px-values to fit it on my phone (HTC one m7, 1080x1920, 468 dpi).
The Code for the Header looks like this:
canvas.drawBitmap(header, null, new Rect(0,0,1080,200), null);
Now i want it to fit on every Screen. I read some tutorials for using dp (is that what i want and need?) but none of them worked. Or am i just using the wrong calculations?
Or do i have to work with f.E. 1/7*width and so on...
Thanks for your time and help.
Either way, you can use dp (density independent pixels) or px, but measure everything yourself at run-time.
Since you're obviously not using the built-in layout classes of Android, you really do have to measure everything yourself.
And yes, by that I mean you have to "work with f.E. 1/7*width and so on...". Just do not assume what the width is, determine that width at run-time.