开发者

What needs to be passed to an editor from a keyboard app to move the cursor one char left?

What key code does an Android editor app expect the keyboard app to send when it is going to be interpret开发者_如何学Goed as a left arrow? In other words, what is the keyboard program supposed to send to its calling program (some kind of editor) if the user intends to move the cursor one char to the left? A related issue: what do the minus values for the "android:codes" attribute mean? () Any pointers to these issues will be appreciated.


I know it's been a long time since you asked this, but I thought I'd throw in my two cents. What I would try in your situation would be this:

InputConnection ic = getCurrentInputConnection();
String textAbove = ic.getTextBeforeCursor(0x100000, 0).toString();
int cursorPos = textAbove.length();
if (cursorPos>0) ic.setSelection(cursorPos-1, cursorPos-1);

That should simulate a left arrow pretty decently.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜