Android-7.0: EditText wrong actionId in editor act

2019-06-24 15:22发布

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);
    }

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

enter image description here

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.

Note: My editText is placed in a listview

1条回答
甜甜的少女心
2楼-- · 2019-06-24 16:08

I have the same problem with using android:imeActionLabel Try remove it and leave default implementation

查看更多
登录 后发表回答