简体   繁体   English

显示软键盘时多行EditText半隐藏

[英]Multiline EditText is half hidden when the soft keyboard is displayed

I have the following code that is inside a ScrollView and the SoftInput.AdjustResize setting, but when the keyboard is shown, it hides half of the EditText .我在ScrollViewSoftInput.AdjustResize设置中有以下代码,但是当显示键盘时,它隐藏了EditText一半 Also, when a new line is added, all the rows above the cursor are shown.此外,当添加新行时,将显示 cursor 上方的所有行。

<EditText
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:inputType="textMultiLine"
    android:isScrollContainer="true"
    android:gravity="top"
    android:minHeight="10dp"
    android:maxLines="6"
    android:minLines="2"
    android:cursorVisible="true"/>

Do you know a way in which I can have the whole EditText displayed?你知道我可以显示整个 EditText 的方法吗?

Also, an implementation without the ScrollView and with SoftInput.AdjustPan was tested, and the result is the same.此外,还测试了没有ScrollView和使用SoftInput.AdjustPan的实现,结果是一样的。

A workaround fix is to set gravity bottom and that way the cursor will be on the second row and the entire EditText is visible.解决方法是设置重力底部,这样 cursor 将位于第二行并且整个 EditText 可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM