Android 如何在虚拟键盘上拦截击键?

Android 如何在虚拟键盘上拦截击键?,android,surfaceview,virtual-keyboard,Android,Surfaceview,Virtual Keyboard,如何在SurfaceView中拦截按键虚拟键盘?这样做。但没有什么是不可能的。请帮忙 InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); inputMgr.toggleSoftInput(0, 0); inputMgr.showSoftInput(mySurface, 0); public class MySurface extends Surface

如何在SurfaceView中拦截按键虚拟键盘?这样做。但没有什么是不可能的。请帮忙

InputMethodManager inputMgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
inputMgr.showSoftInput(mySurface, 0);

public class MySurface extends SurfaceView implements SurfaceHolder.Callback, View.OnTouchListener, OnKeyboardActionListener {...

您应该实现TextWatcher类,并为要控制的所有inout字段设置它。不幸的是,您无法实现通用软键盘按键拦截。看

我需要在新闻发布会上看到它。我不必编辑文本。