开发者

Android IME - how to detect entering a View?

I am trying to write a custom IME for the Android OS. However, I cannot figure out how to detect when the user is entering e.g. an EditText.

I have already tried overriding some of the on...() methods of InputMethodService to no avail.

The documentation hasn't been particularly helpful to me he开发者_StackOverflowre, I'm having a hard time understanding the description of the InputMethodService class.


Use TextWatcher to find out when a user is entering text into an EditText. Otherwise, for any other view, you should be able to override the onFocusChanged method.


Just for documentation purposes: I found the answer myself.

When a view is entered, the InputMethodService's onStartInput(EditorInfo attribute, boolean restarting) method is called. If the EditorInfo's InputType is != 0, the view is editable, it seems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜