
<EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:imeOptions="actionDone" android:inputType="textPassword" />
<EditText android:id="@+id/password" android:layout_width="match_parent" android:layout_height="wrap_content" android:imeActionId="@+id/action_sign_in" android:imeActionLabel="@string/sign_in_short" android:inputType="textPassword" />
mEditText = (EditText) view.findViewById(R.id.password); mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == R.id.action_sign_in) { // Do sign in return true; } return false; } });
本文介绍如何在Android应用中自定义EditText控件的行为,包括设置输入类型为密码及更改键盘上的操作按钮文本,实现点击按钮后触发特定的登录动作。
1万+

被折叠的 条评论
为什么被折叠?



