Hello Guest

Author Topic: Game shrinks when the keyboard pops up on Android  (Read 5938 times)

josh

  • Newbie
  • *
  • Posts: 4
    • View Profile
Game shrinks when the keyboard pops up on Android
« on: November 15, 2013, 03:55:29 am »
Hey!

So, my game view resizes to the available screen when the keyboard pops up on Android. I specify Android because it doesn't have happen on the iOS. It seems Screen.height changes when the Android keyboard pops up. And because of that, my game view resizes to that screen size. Or that's what I think is happening. Is this a common issue and have you heard of this before? Is there a solution to this? One idea I had was adjusting the camera size when the screen height changes. Sorry if this is a repost... I couldn't find anything.

I'm using 2dtk 2.2.3 and unity 4.2.2... thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Game shrinks when the keyboard pops up on Android
« Reply #1 on: November 15, 2013, 12:07:01 pm »
Hi,

If Screen.height changes, then tk2dCamera will be affected directly. You could change the tk2dCamera code (assuming you're using that) to only update the camera early on, and not every frame - that way it shouldn't change the data visible?

josh

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Game shrinks when the keyboard pops up on Android
« Reply #2 on: November 15, 2013, 04:42:53 pm »
I'm not using tk2dCamera. I'm using the main unity camera. Should I be using tk2dCamera? If I decide not to use tk2dCamera, is there another solution you can think of? Have you seen or heard of this problem before?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Game shrinks when the keyboard pops up on Android
« Reply #3 on: November 15, 2013, 05:02:13 pm »
I've not seen the issue before - my android devices are all dead right now. They're recharging now, I'll get back to you when I've had a look.

josh

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Game shrinks when the keyboard pops up on Android
« Reply #4 on: November 15, 2013, 08:30:09 pm »
Ok. sounds good!

Here's another thought. Is there a way to change up the manifest so the keyboard comes in front of the game view, like iOS does?

[EDIT]: so I ended up just resizing and repositioning the camera to compensate for the change in the Screen.height. I would like to know if you found another way or if there is a more efficient way of handling this, so if you find something... please let me know :] Thanks for all your hard work and quickness in responding!! :]
« Last Edit: November 15, 2013, 10:03:33 pm by josh »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Game shrinks when the keyboard pops up on Android
« Reply #5 on: November 15, 2013, 11:15:26 pm »
I think this may be platform dependent. I tried this on a nexus 7 and it appeared exactly as it does on iOS?

josh

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Game shrinks when the keyboard pops up on Android
« Reply #6 on: November 21, 2013, 03:59:04 pm »
oh, hmm... I tried this on 4 different devices, including a tablet, nexus 10, and it all did the same thing. Nonetheless, I did find a work around, which I would not prefer, but am going to use. I'm kind of worried, since you said you couldn't reproduce it, so I'll definitely have to find a nexus 7 and try it on that.