Skip to content

Conversation

@KojiNakamaru
Copy link
Member

cf. #244

@antoniohof
Copy link

antoniohof commented Sep 11, 2017

hi! I have notest that IOS does that automatically. On Android, I was using this solution and so far it is working good:

if (webView.IsKeyboardVisible) {
      keyboardVisible = true;
      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);

			keyboardHeight = Screen.height - Rct.Call<int>("height");
		}
	}
	//Debug.Log ("set keyboard visible " + keyboardHeight);
	webView.SetMargins (0, 0, 0, keyboardHeight);

}else if(keyboardVisible != webView.IsKeyboardVisible){
	webView.SetMargins (0, 0, 0, 0);
}

@KojiNakamaru
Copy link
Member Author

Thanks! I'll later check whether your approach can be applied to the master branch.

@KojiNakamaru
Copy link
Member Author

I've finally implemented #300 based on your code. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants