EditText.setFocusable(假);不能设置为true。 :/ [英] EditText.setFocusable(false); can't be set to true. :/
本文介绍了EditText.setFocusable(假);不能设置为true。 :/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个很奇怪的情况,我有这个code,它应该使一个EditText申请不可编辑的,如果SpnSelected.equals(服务)和可编辑再次,如果别的东西。
A very strange situation, I've got this code that is supposed to make an EditText filed uneditable if SpnSelected.equals("Service") and editable again, if its something else.
final EditText etAdd = (EditText)dialogAddTextView.findViewById(R.id.etSymb);
if ( SpnSelected.equals("Service") )
{
etAdd.setFocusable(false);
TextView tvInfo = (TextView)dialogAddTextView.findViewById(R.id.tvAddTextInfo);
}
else
{
etAdd.setFocusable(true);
TextView tvInfo = (TextView)dialogAddTextView.findViewById(R.id.tvAddTextInfo);
}
它并使其不可编辑好了,但它并没有把编辑回来etAdd.setFocusable(真)的能力;
It does make it uneditable ok, but it doesn't bring the ability to edit back with etAdd.setFocusable(true);
任何想法怎么办呢?谢谢! :)
Any ideas what to do about it? Thanks! :)
推荐答案
尝试
etAdd.setFocusableInTouchMode(true);
etAdd.setFocusable(true);
而不是仅仅
instead of just
etAdd.setFocusable(true);
这篇关于EditText.setFocusable(假);不能设置为true。 :/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文