Android: multiline edittext and keyboard problems

2019-06-16 04:38发布

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条回答
够拽才男人
2楼-- · 2019-06-16 05:18

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)
查看更多
登录 后发表回答