I’m using the following method to get the dimensions of the Android Keyboard so that I can shift some UI elements to sit on top of it (my math is slightly different to accommodate my needs). http://forum.unity3d.com/threads/keyboard-height.291038/
using(AndroidJavaClass UnityClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
AndroidJavaObject View = UnityClass.GetStatic<AndroidJavaObject>("currentActivity").Get<AndroidJavaObject>("mUnityPlayer").Call<AndroidJavaObject>("getView");
using(AndroidJavaObject Rct = new AndroidJavaObject("android.graphics.Rect"))
{
View.Call("getWindowVisibleDisplayFrame", Rct);
return Screen.height - Rct.Call<int>("height");
}
}
This does not include the dimensions for the ‘Mobile Input Field’ (If that’s the real name); this thing: http://i.imgur.com/2PjSBQT.png
How do I get that things position?
I’ve been looking through the Android Documentation and I don’t really understand the connection of what’s going (how it’s getting the keyboard rect), so that I can search for the proper native methods to get the information I want.
Any help would be welcome.
Thank you