有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何正确使用setFocusable

我尝试使用setFocusable,并在有效单击后将其设置为true,但有时它以错误的方式发生。应该改变什么才能正常工作

if (m.matches()) {
               // after do below command. I think is always false due to nothing happend
     editText.setFocusable((!editText.isFocusable()));
               // below comands makes that afther first click in log is true, after second click false and it repeats.
     Log.e("isFocusable",String.valueOf(!editText.isFocusable())); 
     return  true;
} else {
     editText.setError("BlaBla Error");
     editText.setFocusable(true);
     return false;
}

共 (0) 个答案