如何在软键盘上创建自己的键

use*_*546 6 java keyboard android

在xml文件中我做下一步:

   <Row>
        <Key android:codes="FLAG_EDITOR_ACTION" android:keyLabel="Start"  />
    </Row>
Run Code Online (Sandbox Code Playgroud)

在onKeyDown方法的类键盘中,我创建下一个构造

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.FLAG_EDITOR_ACTION: {

            return true;
}
...
Run Code Online (Sandbox Code Playgroud)

但是不行.怎么了?

kum*_*oid 1

你可以在android键盘中添加一些操作,使用

android:imeOptions="actionDone"
Run Code Online (Sandbox Code Playgroud)

有很多类似的 Go、Done、Search 等等...并通过使用 EditorActionListener 执行操作