Getting the dimensions of the soft keyboard

后端 未结 11 753
故里飘歌
故里飘歌 2020-11-27 14:56

Is there a way to know the size of the keyboard that is shown in the screen?

I am using Cocos2dx for programming, but I want to know the height of the keyboard shown

11条回答
  •  -上瘾入骨i
    2020-11-27 15:23

    Sorry for not being able to comment, two or three of the answers helped me solve my issue and they were related to using the AddOnGlobalLayoutListener and then determining the remaining height before and after a keyboard showed up.

    The solution I used was based off of Rudy_TM's answer.

    HOWEVER, one thing that I had to find was that in order for that method to work, you must have the following line somewhere

    Window.SetSoftInputMode(SoftInput.AdjustResize);
    

    Before I had SoftInput.AdjustNothing (or something like that) and it would not work. Now it works perfect. Thanks for the answers!

提交回复
热议问题