开发者

Highlight text in EditText when keyboard opens

开发者 https://www.devze.com 2023-01-25 08:23 出处:网络
I\'d like to highlight the text in an EditText when a keyboard opens for user input (this could be a hardware keyboard or the virtual keyboard).

I'd like to highlight the text in an EditText when a keyboard opens for user input (this could be a hardware keyboard or the virtual keyboard).

Highlighting isn't my problem, my problem is a trigger to highlight. Is there a handler that gets executed when the keyboard appears on a specific View (in this case, my EditText)? Ar开发者_JS百科e there different handlers for hardware keyboard vs virtual keyboard?


As far as I know, you can't get notified of those things at that level. Why not just highlight it when the EditText gets focus? In practice this will generally mean that an IME is displayed.

In fact, there is already a method to do exactly this: setSelectAllOnFocus.

0

精彩评论

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