gpt4 book ai didi

android edittext inputType :textpassword not working with intputType:actionDone on some devices

转载 作者:太空狗 更新时间:2023-10-29 14:46:14 24 4
gpt4 key购买 nike

我对 EditTextinputType 并不陌生,但现在我在设置 android:inputType="textPassword" 除了使用 android:imeOptions="actionDone"

使用的设备是:LG G4 Android v6.0

这是我的代码:

<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
style="@style/TextInputLayoutLoginTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/default_padding_2"
app:passwordToggleDrawable="@drawable/ic_password_visibility_18dp_selector"
app:passwordToggleTint="@color/white">

<com.cashu.app.ui.widgets.CustomEditText
android:id="@+id/et_activity_login_password"
style="@style/EditTextPasswordTheme"
android:layout_width="@dimen/edittext_width"
android:layout_height="wrap_content"
android:ems="12"
android:gravity="center_vertical"
android:hint="@string/activity_consumer_login_password_hint"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:maxLines="1"
android:textColor="@color/white"
android:textSize="@dimen/font_size_small" />

</android.support.design.widget.TextInputLayout>

我的这个 EidtText 代码:

mEtPassword.setOnEditorActionListener(new EditText.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((actionId & EditorInfo.IME_MASK_ACTION) > 0 || actionId == EditorInfo.IME_NULL) {
login();
return true;
}
return false;
}
});

mEtPassword.addTextChangedListener(new LoginTextWatcher(mEtPassword));

这在我的 LG G4 设备上不起作用,onEditorAction 方法也未被调用!

我尝试了很多搜索并使用了其他人的解决方案,但它似乎是制造商问题!

最佳答案

我终于明白了。

我将此 xml 属性添加到我的 EditText:

android:singleLine="true"

我知道它已被弃用,但 android:maxLines="1" 尽管它是 singleLine 的替代品,但无法正常工作。

我也删除了这个:

android:imeOptions="actionDone"

谢谢你们试图帮助我。

关于android edittext inputType :textpassword not working with intputType:actionDone on some devices,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39941935/

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