keyboard=new softKeyboard(this); 在函数开头,当每次调用switchSoftKeyBoardInput(),keyboard 会再生成一个键盘。你关闭的是新生成的,而不是上一次生成的。可以要把这一句放到构造函数中。