当键盘显示时,EditText 的内置滚动不会滚动到最后 - 键盘将文本隐藏在底部
EditText's built-in scroll does not scroll till the end when keyboard is showing - the keyboard hides the text at the bottom
我制作了一个视频来展示当滚动到最后时键盘隐藏了底部的文本:
https://photos.app.goo.gl/XZRDphEmAh5aR9D78
如果您想查看该应用程序和 GitHub 项目并亲自试用该应用程序和代码,您会在此处找到:supernote.org
我已经尝试了清单中的各种内容,例如:
android:windowSoftInputMode="adjustResize"
所以这是 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>
将此添加到清单文件中的 activity 标记:
android:windowSoftInputMode="adjustResize"
或
android:windowSoftInputMode="adjustPan"
例如:
<activity android:name=".MainActivity" android:windowSoftInputMode="adjustResize" android:screenOrientation="portrait" >
</activity>
阅读 和我对那个问题的回答,他有类似的问题。
更新:
尝试使用 ConstraintLayout 而不是 LinearLayout..
我制作了一个视频来展示当滚动到最后时键盘隐藏了底部的文本:
https://photos.app.goo.gl/XZRDphEmAh5aR9D78
如果您想查看该应用程序和 GitHub 项目并亲自试用该应用程序和代码,您会在此处找到:supernote.org
我已经尝试了清单中的各种内容,例如:
android:windowSoftInputMode="adjustResize"
所以这是 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>
将此添加到清单文件中的 activity 标记:
android:windowSoftInputMode="adjustResize"
或
android:windowSoftInputMode="adjustPan"
例如:
<activity android:name=".MainActivity" android:windowSoftInputMode="adjustResize" android:screenOrientation="portrait" >
</activity>
阅读
更新:
尝试使用 ConstraintLayout 而不是 LinearLayout..