I use EditText
in a fragment
which is in a constraintsLayout
, but the editText
do not move up when I typed more line which is more than the screen length.
I tried setting "windowSoftInputMode
" to "adjustPan
" and "adjustResize
", tried setting "isScrollContainer
" true and false.
I tried using a scrollview
and set my EditText
as its child. But all having same problem.
My activity is not fullscreen.
The code below is my manifest
<activity
android:name=".MainActivity"
android:screenOrientation="userPortrait"
android:windowSoftInputMode="stateVisible|adjustPan">
and the following codes are my layout, it is in a constraints layout.
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textCapSentences|textAutoCorrect|textMultiLine|textWebEditText"
android:ems="10"
android:id="@+id/editText"
android:imeOptions="actionSend"
android:scrollHorizontally="false"
android:saveEnabled="true"
android:scrollbars="vertical"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
app:layout_constraintHorizontal_bias="0.0"
android:isScrollContainer="false"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:hint="@string/writeYourPostHere"/>
This is the appearance of my fragment before typing anything.
This is the appearance of my fragment when I typed 20 lines of words "testing" with "line number",it did not move up and the remaining words (Testing 18, Testing 19, Testing 20) are hidden even though I am still typing the words "Testing 20". I want it to move up and show the last words I had typed.
I already read the answer in the following link, but they all appeared the same and cannot solve my problem.
EditText, adjustPan, ScrollView issue in android
adjustPan not preventing keyboard from covering EditText
Forcing adjustPan in activity containing ScrollView
Android EditText Multiline with SoftInputMode adjustPan
How to avoid soft keyboard pushing up my layout?