Aspect Ratios are not the same on devices

Hello Corona Community,

I am having trouble on fitting my game on android devices. I configured the game for multiple aspect ratios but when I test the app on a device the aspect ratio is a bit off. For example, my tablet supposedly has a 16:10 aspect ratio. I configured my game for 16:10 but when I test in on my device the Tablet’s ratio is actually 15.8:9.9 or something close to that. The small difference in the ratio causes my game to go off the screen. Any help will be appreciated. :slight_smile:

Have you looked at using Corona’s built in scaling modes to handle differing aspect ratios?  They can save you a lot of pain if you set them up correctly, and will automatically scale and position the game on a range of devices for you.

** FIXED TYPOS **

Are you hiding the status bar and the button bar?  These both suck up around 80 or more pixels.

local function easyAndroidUIVisibility( profile ) profile = profile or "immersiveSticky" if ( system.getInfo("platformName") == "Android" ) then local androidVersion = string.sub( system.getInfo( "platformVersion" ), 1, 3) if( androidVersion and tonumber(androidVersion) \>= 4.4 ) then native.setProperty( "androidSystemUiVisibility", profile ) elseif( androidVersion ) then native.setProperty( "androidSystemUiVisibility", "lowProfile" ) end end end -- Then later... display.setStatusBar(display.HiddenStatusBar) easyAndroidUIVisibility()

Note: That function (easyAndroidUIVisibility) is in SSK, I simply extracted it for this answer

Thank you roaminggamer, I will apply remove the status bar and navigation bar from the device.

Also in reply to happymongoose,

Thank you for the suggestion but I already have implemented Corona’s scaling modes but they don’t seem to work consistently with my game.

Hi.  Did this help?  If it did, you may run in to case (native.* calls and system events, etc.) that cause the bottom bar to become visible again.  In these cases, just re-run the function I gave you and it will re-hide the bar.

Hello roaminggamer,

Immersivsticky has not worked on my tablet but i will keep trying.

Thanks

Neither immersiveSticky nor lowProfile work universally.  Sorry.

PS - What tablet are you running on (just for reference)?

Have you looked at using Corona’s built in scaling modes to handle differing aspect ratios?  They can save you a lot of pain if you set them up correctly, and will automatically scale and position the game on a range of devices for you.

** FIXED TYPOS **

Are you hiding the status bar and the button bar?  These both suck up around 80 or more pixels.

local function easyAndroidUIVisibility( profile ) profile = profile or "immersiveSticky" if ( system.getInfo("platformName") == "Android" ) then local androidVersion = string.sub( system.getInfo( "platformVersion" ), 1, 3) if( androidVersion and tonumber(androidVersion) \>= 4.4 ) then native.setProperty( "androidSystemUiVisibility", profile ) elseif( androidVersion ) then native.setProperty( "androidSystemUiVisibility", "lowProfile" ) end end end -- Then later... display.setStatusBar(display.HiddenStatusBar) easyAndroidUIVisibility()

Note: That function (easyAndroidUIVisibility) is in SSK, I simply extracted it for this answer

Thank you roaminggamer, I will apply remove the status bar and navigation bar from the device.

Also in reply to happymongoose,

Thank you for the suggestion but I already have implemented Corona’s scaling modes but they don’t seem to work consistently with my game.

Hi.  Did this help?  If it did, you may run in to case (native.* calls and system events, etc.) that cause the bottom bar to become visible again.  In these cases, just re-run the function I gave you and it will re-hide the bar.

Hello roaminggamer,

Immersivsticky has not worked on my tablet but i will keep trying.

Thanks

Neither immersiveSticky nor lowProfile work universally.  Sorry.

PS - What tablet are you running on (just for reference)?