Author Topic: Mobile keyboard questions  (Read 4432 times)

hexaust

  • Newbie
  • *
  • Thank You
  • -Given: 14
  • -Receive: 1
  • Posts: 35
    • View Profile
Mobile keyboard questions
« on: August 28, 2014, 05:49:51 AM »
I am trying to create something similar to an instant messaging app. Right now I have several problems that I don't know how to handle
  • Detecting mobile keyboard height and presence (Not sure if I need that)
  • Align elements that are at the bottom of the screen on the top of the keyboard when is open (with the help of step 1?, my UI is anchored)
  • Keep mobile keyboard open when submitting a message. (still have no ideea how to do that, I checked UIInput.cs but nothing works for me)

I am attaching an example to visualize the case that I'm talking about. (Left is good, right is bad)

Thank you!



badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: Mobile keyboard questions
« Reply #1 on: August 28, 2014, 06:57:17 AM »
You must handle this things by yourself, something like:

Detect when some Input Label, have focus, and then, move everything on your screen up.

I don't thing there is a automatically way of doing that.

hexaust

  • Newbie
  • *
  • Thank You
  • -Given: 14
  • -Receive: 1
  • Posts: 35
    • View Profile
Re: Mobile keyboard questions
« Reply #2 on: August 28, 2014, 07:01:29 AM »
You must handle this things by yourself, something like:

Detect when some Input Label, have focus, and then, move everything on your screen up.

I don't thing there is a automatically way of doing that.

I am trying to do that, but how far should I move things up? How do I get the keyboard size or the new screen height or whatever it takes to get the amount of movement needed for things to show up right above the keyboard?

badawe

  • Jr. Member
  • **
  • Thank You
  • -Given: 8
  • -Receive: 7
  • Posts: 70
    • View Profile
Re: Mobile keyboard questions
« Reply #3 on: August 28, 2014, 11:25:47 AM »
Probably you will need to get this from internet, and put as const on your code. I don't know if exist a way of getting that from Unity

hexaust

  • Newbie
  • *
  • Thank You
  • -Given: 14
  • -Receive: 1
  • Posts: 35
    • View Profile
Re: Mobile keyboard questions
« Reply #4 on: August 29, 2014, 06:27:44 AM »
I don't think that's gonna work, Android has a dozen of screen sizes. Unity has a way to get the portion of the screen which is covered by the keyboard. But unfortunately it only works for iOS, on Android it returns zero-Rect.

http://docs.unity3d.com/ScriptReference/TouchScreenKeyboard-area.html