Android-7.0:编辑器actionlistener中的EditText错误的actionId

问题描述 投票:4回答:1

我有一个在xml中声明的编辑文本,如下所示,我已经设置了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"/>

在代码中我添加了这样的Editor actionlistener。

 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

enter image description here

有人可以指出为什么我在Api-24中获得不同的actionId。如果Android-7.0中的editText有任何变化,请指点我的链接。谢谢。

注意:我的editText放在listview中

android android-studio android-edittext android-7.0-nougat
1个回答
0
投票

我有使用android:imeActionLabel相同的问题尝试删除它并保留默认实现

© www.soinside.com 2019 - 2024. All rights reserved.