why does android multiline edittext work in androidimeoptionsactionnext?

You can set imeOptions=actionNext in XML & at runtime setRawInputType to TYPE_TEXT_FLAG_MULTI_LINE. This way you can achieve this behavior.

According to docs setRawInputType is used for:

Directly change the content type integer of the text view, without modifying any other state.

Example:

XML:

 <EditText
        android:id="@+id/edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:imeOptions="actionNext"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

Activity#onCreate:

binding.editText.setRawInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES
                or InputType.TYPE_TEXT_FLAG_MULTI_LINE)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top