android keyboard open issue
How can i know if the keyboa开发者_如何学编程rd is open or not?
This is available on the Configuration
class. You can get the current Configuration
via getResources().getConfiguration()
from your Activity
or other Context
.
That way =)
public boolean isKeyboardVisible(){
// Checks whether a hardware keyboard is visible
if (getResources().getConfiguration().hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {
return true;
} else if (getResources().getConfiguration()..hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_YES) {
return false;
}
}
精彩评论