I want to know where to float the Android IME.

Asked 2 years ago, Updated 2 years ago, 129 views

There is a blockage during Android development, so I am posting a question to get help.

I want to receive an event or a listener when IME is on in all apps in the Android system I don't think there's an api like that So I think we can find a solution if we look at the framework part The problem is that I can't find the part that floats the IME.

If you know where IME is automatically displayed in the Edit window when focusing, I would like to get advice from experts.

Summary: You want to find the location of the IME show when focusing on the EditText input window.

android frameworks

2022-09-22 13:48

2 Answers

Would you like to refer to this?

https://gist.github.com/felHR85/6070f643d25f5a0b3674


2022-09-22 13:48

As you said, Android does not provide an API to see when the software keyboard is visible or disappeared. That's why looking at the framework source doesn't mean much. (Even if you find a location to show the keyboard, it is likely difficult for applications to leverage it for general use.)

A second (well-known) solution to this problem is to check the content area height of the activity. When the keyboard is displayed, the content area of the activity is reduced by the area of the keyboard, so you can use it to see if the keyboard has been shown and disappeared. Many codes described as solutions that exist on the web are transformed based on the above method.

Please refer to the following link for the actual code and limitations of the above method.


2022-09-22 13:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.