Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我实现了一个控件是软键盘的活动(我想在按下某些键时执行一些操作)
所以我想显示键盘(没有 EditText 或类似的)并阅读触摸
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { return super.onKeyDown(keyCode, event); }
键盘应始终在应用程序中可见。那可能吗?我该怎么做?谢谢
目前无法测试它是否有效,但我知道至少有一个用于 EditTexts 的显示/隐藏软键盘,但它可能适用于任何视图:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInputFromWindow(viewToAnchorTo.getWindowToken(), 0);