当显示键盘时,EditText的内置滚动条不会滚动到末尾-键盘将文本隐藏在底部 [英] EditText's built-in scroll does not scroll till the end when keyboard is showing - the keyboard hides the text at the bottom

查看:107
本文介绍了当显示键盘时,EditText的内置滚动条不会滚动到末尾-键盘将文本隐藏在底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了一个视频,显示当滚动到最后时,键盘将文本隐藏在底部:

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

如果您想签出该应用程序和GitHub项目,并亲自尝试该应用程序和代码,您将在这里找到: supernote.org

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

我已经尝试了清单中的各种内容,例如: android:windowSoftInputMode="adjustResize"

I already tried various stuff in the manifest like: 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>

推荐答案

将其添加到清单文件中的活动标签中:

Add this to your activity tag in your manifest file:

android:windowSoftInputMode="adjustResize"

OR

android:windowSoftInputMode="adjustPan"

例如:

<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.

更新:

尝试使用ConstraintLayout而不是LinearLayout.

Try ConstraintLayout Instead of LinearLayout..

这篇关于当显示键盘时,EditText的内置滚动条不会滚动到末尾-键盘将文本隐藏在底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆