Android-7.0:编辑器actionlistener中的EditText错误的actionId [英] Android-7.0: EditText wrong actionId in editor actionlistener
问题描述
我在xml中声明了这样的具有以下属性的编辑文本,并且设置了android:imeOptions="actionNext"
I have an edit text declared in xml like this with following properties and i have set android:imeOptions="actionNext"
<EditText
android:id="@+id/ui_row_create_poll_edit_text_txt_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/margin_normal"
android:layout_toLeftOf="@id/ui_row_create_task_user_info"
android:background="@android:color/transparent"
android:paddingBottom="@dimen/padding_large_plus_little"
android:paddingLeft="@dimen/padding_large_plus_little"
android:paddingTop="@dimen/padding_large_plus_little"
android:singleLine="true"
android:maxLength="@integer/task_length"
android:imeOptions="actionNext"
android:textColor="@color/black"
android:textSize="@dimen/font_very_large"/>
在代码中,我像这样添加了编辑器动作侦听器.
In code I have added the Editor actionlistener like this.
public boolean onEditorAction(TextView v, int actionId, KeyEventevent{
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT) {
listener.onActionDone(option, etOption);
}
在Api中< 24我得到actionId
作为EditorInfo.IME_ACTION_NEXT
,并且工作正常.但是当我在Android 7.0上运行我的应用程序时,我得到actionId
为EditorInfo.IME_ACTION_IME_ACTION_UNSPECIFIED
In Api < 24 i get actionId
as EditorInfo.IME_ACTION_NEXT
and it works fine. but when I run my app on Android 7.0 I get actionId
as EditorInfo.IME_ACTION_IME_ACTION_UNSPECIFIED
有人可以指出为什么我在Api-24中得到不同的actionId. 如果Android-7.0中的editText有任何更改,请指向一些链接. 谢谢.
Can somebody point out why i am getting different actionId in Api-24. If there are any changes in editText in Android-7.0 kindly point me to some links. Thanks.
注意:我的editText放置在列表视图中
Note: My editText is placed in a listview
推荐答案
我在使用时遇到了同样的问题
android:imeActionLabel
尝试删除它并保留默认实现
I have the same problem with using
android:imeActionLabel
Try remove it and leave default implementation
这篇关于Android-7.0:编辑器actionlistener中的EditText错误的actionId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!