Android: multiline edittext and keyboard problems

依然范特西╮ 提交于 2019-12-10 12:39:58

问题


i have this edittext:

<EditText android:inputType="textMultiLine|textCapSentences"
    android:layout_width="fill_parent"
android:layout_height="240dp"
android:scrollHorizontally="false"
android:imeOptions="actionNone"
android:minLines="9"
android:scrollbars="vertical"
android:singleLine="false"
    android:gravity="top"
android:layout_gravity="center_vertical|left"
android:nextFocusForward="@+id/costo_dettagli"
android:layout_weight="1"
android:id="@+id/dettagli"
android:textSize="20sp" />

and this part of manifest:

android:windowSoftInputMode="stateHidden|adjustPan"

the problem? when the keyboard show up, it goes below the blinking cursor (at the first line in other words) and not below the entire edittext! In need to have the keyboard below the widget.

All of my layout is in a scrollview, and i've tried all of the android:windowSoftInputMode

edittext problem http://imageshack.com/a/img199/9295/jmgb.png

What the hell?? i need help, please.


回答1:


you can use:

android:imeOptions="flagNoExtractUi"

in xml file

or in main add this:

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {

    outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;

    // etc.
}

or in oncreate insert this code:

editText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI)


来源:https://stackoverflow.com/questions/21884882/android-multiline-edittext-and-keyboard-problems

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