EightBitSpade
Lurker
My question here regards drawing an image at the same place on the screen, in code, regardless of the screen size or resolution. I know that I can use dips in my layout, instead of regular pixels, to help everything be sized and placed more appropriately on different screens, but here I'm talking about doing it in code.
Say, for example, I am using a custom surface view, and in my override of its onDraw function, I'm drawing an image to the screen using canvas.drawBitmap. That function takes in two numbers for coordinates, but only in hard pixels - so the actual location of the drawn image varies depending on the screen you're viewing the app on. My question is how can I draw that image in that onDraw function so that it appears in the same relative place on every screen?
Say, for example, I am using a custom surface view, and in my override of its onDraw function, I'm drawing an image to the screen using canvas.drawBitmap. That function takes in two numbers for coordinates, but only in hard pixels - so the actual location of the drawn image varies depending on the screen you're viewing the app on. My question is how can I draw that image in that onDraw function so that it appears in the same relative place on every screen?