I have a ListView
which contains EditText
as items and also EditText
in ListView
header.
When I tap on any EditText
it shows the keyboard and allows me to enter text. But if I press the back button, it hides the keyboard and then tap on the EditText
which was previously focused, does not open the keyboard.
Here is my EditText
declared in xml
<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:imeOptions="actionNext"
android:maxLength="@integer/task_length"
android:maxLines="1"
android:paddingBottom="@dimen/padding_large_plus_little"
android:paddingLeft="@dimen/padding_large_plus_little"
android:paddingTop="@dimen/padding_large_plus_little"
android:textColor="@color/black"
android:textSize="@dimen/font_very_large" />
I have tried added onFocusedchanged
listener and onTouchListener
but it doesn't work.
I have also tried to add the onClickListener
and added the following code to display keyboard forcefully but this does not work either.
InputMethodManager inputMethodManager = (InputMethodManager) context.
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInputFromInputMethod(windowToken, 0);
It works fine on < Android-7.0
, but causes problem in API 24.
Is there any specific changes in Android 7.0
related to EditText
? Or can somebody come up with some solution?
Note: I am facing this issue only on Android-7.0. On previous version it works fine. Also I have faced another issue which is also only occurring on 7.0