【发布时间】:2013-07-04 07:08:00
【问题描述】:
我有两个基于单选按钮更改事件的 EditText txtPassword,txtEmail 我只是隐藏和显示 txtPassword 字段
我只想用 porgrammatic 更改 ImeOptions,因为我编写了以下代码
但这不起作用。当我观察软键盘时,这表明我在 txtEmail 中完成了操作(只是因为在收音机更改之前只有 txtEmail 可见,所以出现自动完成)
但是在手动关注密码字段之后,如果我观察到带有电子邮件字段的软键盘,它会自动使用下一个 imeOptions 更改它。我只想要一个 txtEmail 是否可见而不是 imeOptions 并且如果 txtPassword、txtEmail 两者都可见,那么 txtEmail 下一个有 ImeOptions 并且在 txtPassword 中它显示了 imeOptions。提前致谢。txtPassword.setImeOptions(EditorInfo.IME_ACTION_DONE);
txtEmail.setImeOptions(EditorInfo.IME_ACTION_NEXT);
编辑:
radiologin.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group,int checkedId) {
// checkedId is the RadioButton selected
if (checkedId == R.id.radioWithoutPassword) {
txtPassword.setVisibility(View.GONE);
txtEmail.setBackgroundDrawable(getResources().getDrawable(R.drawable.both_corner));
txtEmail.setImeOptions(EditorInfo.IME_ACTION_DONE);
}
else
{
txtEmail.setImeOptions(EditorInfo.IME_ACTION_NEXT);
txtPassword.setImeOptions(EditorInfo.IME_ACTION_DONE);
txtPassword.setVisibility(View.VISIBLE);
txtEmail.setBackgroundDrawable(getResources().getDrawable(R.drawable.top_corner));
}
}
});
【问题讨论】:
标签: android