EditText's built-in scroll does not scroll till the end when keyboard is showing - the keyboard hides the text at the bottom

大城市里の小女人 提交于 2019-12-11 15:27:07

问题


I made a video to show that when scrolling till the end the keyboard hides the text at the bottom:

https://photos.app.goo.gl/XZRDphEmAh5aR9D78

if you want to check out the app and the GitHub project and play around with the app and code for yourself you will find that here: supernote.org

I already tried various stuff in the manifest like: android:windowSoftInputMode="adjustResize"

So this is the xml:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="16dp"
    tools:activity=".EditNoteActivity"
    android:weightSum="100"
    android:id="@+id/linearLayoutEditNoteActivity"
    >
      <EditText
            android:id="@+id/edit_text_title"
            android:textSize="25sp"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:inputType="text"
            tools:ignore="Autofill,LabelFor"
            android:layout_weight="90"
            android:gravity="top"
            />



        <EditText
            android:gravity="top"
            android:layout_weight="10"
            android:id="@+id/edit_text_description"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:inputType="textMultiLine"
            tools:ignore="Autofill,LabelFor"
            android:background="@null"
            />
</LinearLayout>

回答1:


Add this to your activity tag in your manifest file:

android:windowSoftInputMode="adjustResize"

OR

android:windowSoftInputMode="adjustPan"

for example:

<activity android:name=".MainActivity" android:windowSoftInputMode="adjustResize" android:screenOrientation="portrait" >
</activity>

Read this question here and my answer to that question, He had a similar issue.

Update:

Try ConstraintLayout Instead of LinearLayout..



来源:https://stackoverflow.com/questions/58918517/edittexts-built-in-scroll-does-not-scroll-till-the-end-when-keyboard-is-showing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!