Way to be notified when the software keyboard is showing/hiding?

前端 未结 2 1077
猫巷女王i
猫巷女王i 2021-01-06 19:51

Is there a way to be notified when the keyboard is about to show, or has shown? The following events would be great:

keyboardWillShow keyboardDidShow keyboardWillHi

相关标签:
2条回答
  • 2021-01-06 19:53

    As MatrixFrog mentioned you can use the Activity's onCofigurationChanged method. With that you have keyboardWillShow and keyboardWillHide.

    To get the other two you can try using one of the InputMethodManager's methods but I don't think a callback like that exists.

    0 讨论(0)
  • 2021-01-06 20:10

    The only way is to override the View's onSizeChanged() method. See this thread on the Android Developers group:

    http://groups.google.com/group/android-developers/browse_thread/thread/9d1681a01f05e782

    0 讨论(0)
提交回复
热议问题