Android:在PreferenceGroup中删除对EditText的关注
我有一个表单,当提交此表单时,我想禁用我的文本编辑,请您帮助我实现此功能 提前谢谢 下面是我的课程的一部分,提交按钮是:Android:在PreferenceGroup中删除对EditText的关注,android,android-edittext,sharedpreferences,preferences,Android,Android Edittext,Sharedpreferences,Preferences,我有一个表单,当提交此表单时,我想禁用我的文本编辑,请您帮助我实现此功能 提前谢谢 下面是我的课程的一部分,提交按钮是: public class MyForm extends PreferenceGroup implements View.OnClickListener { if (isFormSubmited) { submitter.disable(); FormField.buttonCatchButton.setText("View"
public class MyForm extends PreferenceGroup implements View.OnClickListener {
if (isFormSubmited) {
submitter.disable();
FormField.buttonCatchButton.setText("View");
updateForm();
}
禁用editTex的我的按钮
private void disable(ViewGroup layout) {
layout.setEnabled(false);
for (int i = 0; i < layout.getChildCount(); i++) {
View child = layout.getChildAt(i);
if (child instanceof ViewGroup) {
disable((ViewGroup) child);
} else {
child.setEnabled(false);
}
}
}
我的问题是我不知道如何设置:如果表单提交,formFragment需要让其子视图显示该字段已禁用。@shylendra您有什么建议吗?只需转到xml文件,右键单击“编辑文本”,然后通过转到“图形布局”选择“清除焦点”选项。@shylendra然后它将始终保持清晰焦点,但我只想在提交表单时使用它!!!
public void onClick(View v) {
FormFragment formFragment = new FormFragment();
Bundle bundle = new Bundle();
bundle.putString(Constants_Args.ITEMS_KEY, itemsKey);
if (catchFormFile != null) {
bundle.putString(Constants_Args.CATCH_FORM_FILE_PATH, catchFormFile.getAbsolutePath());
}
if (catchFormJSONObject != null) {
bundle.putString(Constants_Args.CATCH_FORM_JSONOBJECT, catchFormJSONObject.toString());
}
if (catchSpeciesJSONArray != null) {
bundle.putString(Constants_Args.CATCH_SPECIES_JSONARRAY, catchSpeciesJSONArray.toString());
}
catchFormFragment.setArguments(bundle);
MainActivity mainActivity = (MainActivity)getContext();
mainActivity.pushFragment(formFragment);
}