1

我在 v4 支持片段中创建了一个软键盘,但我认为我做错了。键盘显示正常,但我无法隐藏它(后退按钮关闭程序)。否则它工作正常。我希望硬件后退按钮能够仅关闭键盘。

myKeyboard = new Keyboard(getActivity(), R.xml.my_keyboard);
myKeyboardView = (MyKeyboardView) getActivity().findViewById(R.id.my_keyboard_view);
myKeyboardView.setKeyboard(myKeyboard);
// this is a custom class to receive soft keyboard events
// just passes on the events to the Activity as normal
keyboardView.setOnKeyboardActionListener(new MyKeyboardListener(getActivity())); 

为了让键盘显示出来,我OnClickListener在目标EditText上使用了动画并将 设置VisibilityVISIBLE

我应该使用这种方法吗?我寻找了一种将键盘放在后堆栈上的方法,但这并不明显。

4

0 回答 0