Android-7.0:编辑器actionlistener中的EditText错误的actionId [英] Android-7.0: EditText wrong actionId in editor actionlistener

查看:142
本文介绍了Android-7.0:编辑器actionlistener中的EditText错误的actionId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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上运行我的应用程序时,我得到actionIdEditorInfo.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆