OnButtonClick 监听器我想禁用 EditText 进行编辑,然后再打开它。
下面两行我禁用了 EditText
editTextWight.setEnabled(false);
editTextWight.setFocusable(false);
但是当我尝试将其转回时却失败了。键盘打不开。
editTextWight.setFocusable(true);
editTextWight.setFocusableInTouchMode(true);
editTextWight.setClickable(true);
editTextWight.setEnabled(true);
请帮助我启用 EditText。
最佳答案
您可以尝试适用于我的项目代码的这两行:
editTextWight.setFocusable(true);
editTextWight.setFocusableInTouchMode(true);
例如,调用 afterTextChanged()
是因为我必须先禁用此 EditText
,然后再启用它!
因此,只需尝试使用上面的两个方法调用而不是所有四个方法调用即可。
祝你好运,让我知道它是否有效!
关于android - 禁用后启用 Edittext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39685945/