gpt4 book ai didi

Android imeOptions 和自动按下登录按钮

转载 作者:太空宇宙 更新时间:2023-11-03 10:55:16 26 4
gpt4 key购买 nike

我有典型的登录屏幕。我能够使用 imeOptions 允许用户从一个字段“tab”到另一个字段,在最后一个字段(密码)上我有 actionDone - 它只是关闭软键盘。理想情况下,我喜欢自动点击“登录”。有什么内置的吗?

最佳答案

将 imeOptions 添加到您的密码 EditText 并以编程方式定义操作。

XML:

            <EditText
android:id="@+id/passordEditText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter password"
android:inputType="textPassword"
android:imeOptions="actionSend"/>

java :

EditText passwordET= v.findViewById(R.id.passwordEditText);
passwordET.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
boolean mHandled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
onClick(yourLogInMethod);
mHandled = true;
}
return mHandled;
}
});

关于Android imeOptions 和自动按下登录按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5943081/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com