I have used SurfaceView in my game. Right Now, I have created layout considering one device (320 x 480). The game layout looks nice and all functions are working properly. But when I see the same game in anot开发者_运维知识库her device with different dimension (screen size), the layout does not seem to be proper.
So is there any property, method, formula or helping Tutorial by which I can create game design/layout through canvas which looks same in all screen size devices.
There is one simple hint: don't ever use absolute coordinates on the SurfaceView
. Every item's position should be calculated at runtime depending on the actual screen size. This way you'll achieve a layout that will look the same way on every device. Hope this helps.
精彩评论