1、初始化的时候要设置 :
binding.etName.setKeyListener(null);
2、添加监听事件
binding.etName.setOnFocusChangeListener((view, b) -> {
if (b) {
binding.etName.setKeyListener(new TextKeyListener(TextKeyListener.Capitalize.NONE, true));
} else {
binding.etName.setKeyListener(null);
}
});