I have an EditText in my App where i've set in it's xml android:imeOptions="actionDone"
and them in my fragment i'm trying to cast a function which should do stuff on Done click, but instead it has no effect and the softkeyboard doesn't even close.. in bebug the EditorActionListener is not reached when done is pressed...
Which could be the issue of it?
In my fragment the EditorActionListener looks like this:
private lateinit var txtQta: EditText
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
txtQta = view.findViewById(R.id.txtQta)
txtQta.setOnEditorActionListener { _, i, _ ->
when(i) {
EditorInfo.IME_ACTION_DONE -> {
addArticolo()
true
}
else ->
false
}
}
}
my editText:
<EditText
android:id="@+id/txtQta"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:autofillHints="qty"
android:text="@string/_1"
android:hint="@string/qta"
android:inputType="number|numberDecimal"
android:padding="15dp"
android:selectAllOnFocus="true"
android:imeOptions="actionDone"
android:singleLine="true"
android:textAlignment="center"
android:textStyle="bold" />
EDIT:
Actually i had another EditorActionListener registered so for that reason it wasn't working..
question from:
https://stackoverflow.com/questions/65935633/unable-to-reach-editoraction-in-edittext 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…