| bio | website | zainodis.com |
|---|---|---|
| location | ||
| age | ||
| visits | member for | 1 year, 1 month |
| seen | Dec 28 '12 at 19:17 | |
| stats | profile views | 46 |
|
Dec 28 |
comment |
Fitting Android game to different screen sizes @SulemanKhan thank you very much, I am glad it helped you :) |
|
Jun 9 |
awarded | Quorum |
|
Jun 5 |
awarded | Commentator |
|
Jun 5 |
comment |
Fitting Android game to different screen sizes @user1404512 well thank you too and I am glad I could help :) |
|
Jun 4 |
comment |
Fitting Android game to different screen sizes Ok wild shot - how you obtain the metrics should not matter, but try adding this to your AndroidManifest.xml: <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="8" /> and add it as a child of your manifest tag. You can find further explanations here: stackoverflow.com/questions/5078808/… Basically make sure your min SDK is >=4 and your target SDK is >= 8 - it sounds esoteric, but please let me know if it worked out. |
|
Jun 3 |
comment |
Fitting Android game to different screen sizes @user1404512 To obtain the DisplayMetrics use this: getResources().getDisplayMetrics() in your activity or prepend a valid context. The object returned by getDsplayMetrics() contains the width/height and some other value of the display. Did u try logging those width/height values to verify that they're correct? Which of the calculations always ends up being 1 ? I need more details ;) |
|
Jun 2 |
comment |
Fitting Android game to different screen sizes @user1404512 I am not a genius, that's for sure ;) but I am glad if I can help you - I updated my answer - please see the section HOW TO SCALE BITMAPS - I added the requested info |
|
Jun 2 |
revised |
Fitting Android game to different screen sizes added 1693 characters in body |
|
Jun 2 |
revised |
Fitting Android game to different screen sizes Added algorithm |
|
Jun 2 |
revised |
Fitting Android game to different screen sizes Improved formatting |
|
Jun 2 |
revised |
Fitting Android game to different screen sizes deleted 25 characters in body |
|
Jun 2 |
revised |
Fitting Android game to different screen sizes added 549 characters in body |
|
Jun 2 |
comment |
Fitting Android game to different screen sizes @user1404512 I added some math to my answer to explain the location calculations |
|
Jun 2 |
comment |
Fitting Android game to different screen sizes @user1404512 I already wrote in my post on how to scale bitmaps. However you'd have to calculate the scale-factor based on the relation between the bitmap and the screen size (let me know if you need more details to understand what I mean). As for the location: YOU MUST dynamically determine the x/y of your bitmaps. For this purpose you need to know the relative location of the bitmap in relation to the screen (up, down, left, right etc..). |
|
May 31 |
revised |
Fitting Android game to different screen sizes added additional answer |
|
May 31 |
revised |
Fitting Android game to different screen sizes added additional answer |
|
May 31 |
revised |
Fitting Android game to different screen sizes added additional answer |
|
May 31 |
comment |
Fitting Android game to different screen sizes @user1404512 It's really important, that you answer all those questions we asked you, because we're still kind of in the dark as to how your layout is designed, which makes it difficult to answer any specific question. As for your bitmaps: I updated my answer to answer the bitmap-scaling question the best I could, given that very little is known about your setup. |
|
May 30 |
awarded | Supporter |
|
May 30 |
comment |
Fitting Android game to different screen sizes @user1404512 A SurfaceHolder.Callback is usually linked to a SurfaceView - and it also depends on how that SurfaceView is configured (width/height) if it's embedded in another Layout (like FrameLayout etc.)... in your A SurfaceHolder.Callback there should be a method: public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) the width and height should be the size of what's being drawn on screen - which in your case would be the same on tablets & smartphones - can you verify that? |