问题
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
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:
I have the same problem with using
android:imeActionLabel
Try remove it and leave default implementation
来源:https://stackoverflow.com/questions/39784856/android-7-0-edittext-wrong-actionid-in-editor-actionlistener