I got a few reports from users who are using the Nexus 7 tablet that the top part of the screen is out of position. So far that is the only device that seems to have that problem. I have tested it on all my devices and friends devices and simulator devices and none of them have that problem at all (I don’t have a Nexus 7 to test it on). Nor has anyone else reported anything about it being out of place. Only the Nexus 7 seems to be having that problem… anyone come across this before or might have an idea of what’s going on? Thanks in advance for any help.
This is actually a known bug in Corona. An app supporting both portrait and landscape orientations on an Android “tablet” running OS version 3.0 or higher will have its contents shifted onscreen when changing orientation. The reason is because the app window gets resized during the orientation change, since the navigation bar moves along with the app on tablets… meaning that the aspect ratio of the app changes.
This is not an issue with Android phones.
The only workaround at this time is to set up the app to use a fixed orientation (either landscape or portrait, but not both). For example, “portrait” and “portraitUpsideDown” OR “landscapeRight” and “landscapeLeft”.
Brent
Hey Brent thanks for the reply and the info. Unfortunately, I already have a fixed orientation
orientation = { default = "portrait", supported = { "portrait", } },
I’ve asked the person who reported it to take a screenshot if possible so I could show you exactly but so far no answer =( Any other known issues or ideas? Thanks in advance
What happens if you add both portrait orientations as supported? I would think that would be preferable anyway (it would be for me, as a user, so I wouldn’t need to flip it to exactly that orientation to play).
If you can get a screenshot of the issue, please post it here. There have been a few really weird, seemingly random issues with Nexus tablets in the past and this might be another of them.
Thanks,
Brent
This is actually a known bug in Corona. An app supporting both portrait and landscape orientations on an Android “tablet” running OS version 3.0 or higher will have its contents shifted onscreen when changing orientation. The reason is because the app window gets resized during the orientation change, since the navigation bar moves along with the app on tablets… meaning that the aspect ratio of the app changes.
This is not an issue with Android phones.
The only workaround at this time is to set up the app to use a fixed orientation (either landscape or portrait, but not both). For example, “portrait” and “portraitUpsideDown” OR “landscapeRight” and “landscapeLeft”.
Brent
Hi Brent,
I think it’s not limited to the Galaxy Nexus!
We are observing some strange behaviour on Android Galaxy Tab 10.1 (not simulator or apple), and were about to buy a new android device to test the behaviour, when we stumbled over this post.
- Would you mind looking into our post and confirm that this is the same issue ? I posted it here http://forums.coronalabs.com/topic/34815-rectangles-hit-area-become-imprecise-shift-when-switching-to-landscape-mode/
This is a very urgent issue for us, as it prohibits us to use our application in landscape mode!
Thanks a lot! Your feedback is much appreciated.
Best
Frank
@frank76, this could be the same issue. You need to try and lock your orientation on the app until Google fixes this.
@hatethinkingofnames, I have a nexus 7, if you’re app is free, I can download it and try to get the screen shot so we at least can see what’s going on. Can we see your config.lua please?
Hey, I was actually going to reply to this saying I still couldn’t get someone to screenshot but that’d awesome of you Rob.
https://play.google.com/store/apps/details?id=lol.goons.calculator
What you have to do is swipe so you get to the screen on the left with a green~ish background, hit the Jungle button and tap any icon, then go back to that screen and hit Jungle again and take a screenshot of that. I tried a few things by setting the .x and .y position seperately instead of in the display.newRect(x y), so it’d be funny if that fixed it. But I’ll wait to see the screenshot and let you know whats off, thanks again!
My config lua is pretty much your ultimate config file, but here it is:
https://dl.dropboxusercontent.com/u/12233342/config.lua
Thanks for the help and good luck with your problem frank
What I’m seeing on some screens (with Ads and one button) is that the softbar at the bottom is cutting off the bottom of that button. On one other screen there are some icons getting cut by the softbar. However on that one, there are some blocks showing at the top of the screen that seem out of place.
Here’s what it’s supposed to look like:
Weird.
The way I made a lot of positioning is.
theH = display.contentHeight theW = display.contentWidth theX = ((theW - 320) / 2) theY = (theH - 480) / 2
and pretty much added theX and theY to objects so that they would be placed according to the size of the device. So I don’t really see why they’d be off screen? Since it’s coded to take the extra size of the screen and move it down to center it, shouldn’t be able to go off screen.
display.contentWidth should be 320 and display.contentHeight should be 570 based on the config.lua. I’m pretty sure that device is greater than a 1:1.72 ratio.
The problem is that the softbar is part of the screen’s pixel count. Maybe try:
theH = display.contentHeight - 20
if you’re on Android (or whatever that distance needs to be)
Ah I get what you mean. I thought there was a command that would show how much the device loses? Or maybe it was something else.
Does display.statusBarHeight help at all?
Maybe the command was display.screenOriginY. I remember it used to give 0 on lots of devices but some would have like 14 or small amounts. Is this a Nexus/tablet thing, didn’t really put much effort in supporting tablets honestly, or is this for all Android devices having 20~ pixels off cuz of the softbar? Think I wouldov got a lot of complains if it was on normal devices too
Ok, reading the descriptions, it seems as if something is not displayed correctly. Thats not our case.
In our case, on this android device, the display is correct, but the hit area doesn’t match the display area of display objects, for instance rectangles. See http://forums.coronalabs.com/topic/34815-rectangles-hit-area-become-imprecise-shift-when-switching-to-landscape-mode/
It’s not a coding issue, as it works on ipad and simulator. Its not a problem in our code, as we don’t compute the hit area as we use an event listener.
Has CL encountered a similar issue before ? Please let us know.
thanks
Frank
settings =
{
androidPermissions =
{
“android.permission.VIBRATE”,
“android.permission.INTERNET”
},
iphone =
{
plist =
{
CFBundleIconFile = “Icon.png”,
CFBundleIconFiles = {
“Icon.png” ,
“Icon-hdpi.png” ,
“Icon-ldpi.png” ,
“Icon-mdpi.png”
},
CFBundleDisplayName = “PLViewer”,
UIPrerenderedIcon = true,
UIApplicationExitsOnSuspend = true,
UIStatusBarHidden = true,
},
},
orientation =
{
supported = { “landscapeLeft”, “landscapeRight”, “portrait”, “portraitUpsideDown”, }
}
}
This is the one you are looking for:
http://docs.coronalabs.com/api/library/display/topStatusBarContentHeight.html
@frank76, can you continue this in your original thread so we can keep this one on tack. It’s really hard to try and solve different issues since readers don’t know which answers go with which questions.
Hey Brent thanks for the reply and the info. Unfortunately, I already have a fixed orientation
orientation = { default = "portrait", supported = { "portrait", } },
I’ve asked the person who reported it to take a screenshot if possible so I could show you exactly but so far no answer =( Any other known issues or ideas? Thanks in advance
What happens if you add both portrait orientations as supported? I would think that would be preferable anyway (it would be for me, as a user, so I wouldn’t need to flip it to exactly that orientation to play).
If you can get a screenshot of the issue, please post it here. There have been a few really weird, seemingly random issues with Nexus tablets in the past and this might be another of them.
Thanks,
Brent
Hi Brent,
I think it’s not limited to the Galaxy Nexus!
We are observing some strange behaviour on Android Galaxy Tab 10.1 (not simulator or apple), and were about to buy a new android device to test the behaviour, when we stumbled over this post.
- Would you mind looking into our post and confirm that this is the same issue ? I posted it here http://forums.coronalabs.com/topic/34815-rectangles-hit-area-become-imprecise-shift-when-switching-to-landscape-mode/
This is a very urgent issue for us, as it prohibits us to use our application in landscape mode!
Thanks a lot! Your feedback is much appreciated.
Best
Frank
@frank76, this could be the same issue. You need to try and lock your orientation on the app until Google fixes this.
@hatethinkingofnames, I have a nexus 7, if you’re app is free, I can download it and try to get the screen shot so we at least can see what’s going on. Can we see your config.lua please?
Hey, I was actually going to reply to this saying I still couldn’t get someone to screenshot but that’d awesome of you Rob.
https://play.google.com/store/apps/details?id=lol.goons.calculator
What you have to do is swipe so you get to the screen on the left with a green~ish background, hit the Jungle button and tap any icon, then go back to that screen and hit Jungle again and take a screenshot of that. I tried a few things by setting the .x and .y position seperately instead of in the display.newRect(x y), so it’d be funny if that fixed it. But I’ll wait to see the screenshot and let you know whats off, thanks again!
My config lua is pretty much your ultimate config file, but here it is:
https://dl.dropboxusercontent.com/u/12233342/config.lua
Thanks for the help and good luck with your problem frank
What I’m seeing on some screens (with Ads and one button) is that the softbar at the bottom is cutting off the bottom of that button. On one other screen there are some icons getting cut by the softbar. However on that one, there are some blocks showing at the top of the screen that seem out of place.