I have a fragment which contents a ViewPager2 of 2 fragemnts. In the second child fragment, I have a recyclerview which viewholder contains TextView and EditText.
In emulator, when I click in EditView, the soft keyboard keep closing.
In real device (Sony xperia XA), the soft keyboard not closing but it always focus on the first edit text whether I click in another EditText
I have tried to use android:windowSoftInputMode="adjustPan" and android:windowSoftInputMode="adjustResize" but it don't fix the problem.
I use DataBinding and ConstraintLayout outside LinearLayout
<LinearLayout
android:id="@+id/wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="vn.com.ntn.obee.screens.fragments.exercise.InputQuestionFragment">
<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_medium"
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginBottom="@dimen/margin_medium"
android:paddingTop="@dimen/margin"
android:paddingBottom="@dimen/margin_medium"
app:cardCornerRadius="20dp"
app:cardElevation="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/layoutQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/question_drawable"
android:orientation="vertical"
android:paddingTop="@dimen/margin"
android:paddingBottom="@dimen/margin"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<vn.com.ntn.obee.screens.views.SelectableTextView
android:id="@+id/tvQuestion"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingMultiplier="1.6"
android:maxHeight="200dp"
android:paddingStart="@dimen/margin_medium"
android:paddingEnd="@dimen/margin_medium"
android:paddingTop="@dimen/margin"
android:paddingBottom="@dimen/margin_medium"
android:scrollbars="vertical"
android:fontFamily="@font/proxima_nova_bold"
android:textColor="@color/white"
android:textSize="@dimen/text_size_normal"
app:htmlText="@{answer.content ?? answerResult.contentExtend}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/etAnswer"
android:layout_width="match_parent"
android:layout_height="@dimen/size_icon_x5"
android:hint="@string/enter_your_answer_here"
android:paddingStart="@dimen/margin_medium"
android:paddingEnd="@dimen/margin_medium"
android:paddingBottom="2dp"
android:layout_marginStart="@dimen/margin_medium"
android:layout_marginEnd="@dimen/margin_medium"
android:layout_marginBottom="@dimen/margin_small"
android:background="@drawable/bg_input_question_edittext"
android:fontFamily="@font/proxima_nova_bold"
android:textColor="@color/pink"
android:textColorHint="#FFC9C9"
android:textSize="@dimen/text_size_medium"
android:singleLine="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvQuestion"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="1"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
I think these log may have I find the problem:
2020-10-12 00:20:43.527 3051-3051/? I/KeyboardViewUtil: KeyboardViewUtil.getKeyboardHeightRatio():128 systemKeyboardHeightRatio:1.000000; userKeyboardHeightRatio:1.000000.
2020-10-12 00:20:43.528 3051-3051/? I/AndroidIME: AbstractIme.onActivate():83 LatinIme.onActivate() : EditorInfo = Package = com.nghianguyen.obee_android.debug : Type = Text : Learning = Enable : Suggestion = Show : AutoCorrection = Enable : Microphone = Show : NoPersonalizedLearning = Disable, IncognitoMode = false
2020-10-12 00:20:43.529 3051-3051/? I/Delight5Facilitator: Delight5Facilitator.initializeForIme():572 initializeForIme() : Locale = [en_US], layout = qwerty
2020-10-12 00:20:43.529 3051-3051/? I/VoiceInputManagerWrapper: VoiceInputManagerWrapper.cancelShutdown():54 cancelShutdown()
2020-10-12 00:20:43.529 3051-3051/? I/VoiceInputManagerWrapper: VoiceInputManagerWrapper.syncLanguagePacks():66 syncLanguagePacks()
2020-10-12 00:20:43.557 3051-6376/? I/SpeechFactory: SpeechRecognitionFactory.maybeScheduleAutoPackDownloadForFallback():155 maybeScheduleAutoPackDownloadForFallback()
2020-10-12 00:20:43.569 1845-1845/? E/servicemanager: Could not find android.hardware.power.IPower/default in the VINTF manifest.
2020-10-12 00:20:43.596 3051-3051/? I/KeyboardWrapper: KeyboardWrapper.consumeEvent():264 Skip consuming an event as current keyboard is deactivated (state=0, keyboard existence=true)
2020-10-12 00:20:43.669 3051-3051/? W/KeyboardModeManager: KeyboardModeManager.setInputView():359 setInputView() : inputView = com.google.android.apps.inputmethod.libs.framework.core.InputView{cb5f35e V.E...... ......ID 0,0-1080,2022}
2020-10-12 00:20:43.672 3051-3051/? I/ConversationToQueryExtension: ConversationToQueryExtension.isEnabledForHostApp():254 Conv2Query not enabled due to current app [com.nghianguyen.obee_android.debug] not in whitelist
2020-10-12 00:20:43.672 3051-3051/? I/ConversationToQueryExtension: ConversationToQueryExtension.onActivate():165 onActivate() : Disabled by unsupported host app