TextInputLayout is being overridden by the system keyboard

Viewed 27

I am new to android. I have layout with TextInputLayout and MaterialButton. If you enter too large a value, edittext creeps down. Why is there such an error? The information I found on the internet did not help me. How to fix it? Help me please.

If you set layout_height to input_layout to 0dp, then initially edittext looks too big

Here's what it looks like:

enter image description here

My layout file:

``` <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:fitsSystemWindows="true"
    android:background="@color/black">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/activity_comment_toolbar"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/left_guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_begin="16dp" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/right_guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_end="16dp" />

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/comment_input_layout"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:background="@drawable/comment_input_background"
        android:hint="Введите текст комментария"
        android:paddingStart="16dp"
        android:paddingTop="10dp"
        app:endIconDrawable="@drawable/ic_cancel_black_24dp"
        app:endIconMode="clear_text"
        app:errorTextAppearance="@style/TextInputLayoutAppearance"
        app:errorTextColor="@color/error"
        app:hintTextColor="@color/gray1"
        app:layout_constraintBottom_toTopOf="@+id/activity_comment_apply_button"
        app:layout_constraintEnd_toEndOf="@id/right_guideline"
        app:layout_constraintStart_toEndOf="@id/left_guideline"
        app:layout_constraintTop_toBottomOf="@id/activity_comment_toolbar"
        app:layout_constraintVertical_bias="0.0">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/comment_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:imeOptions="actionNext"
            android:inputType="textMultiLine|textNoSuggestions"
            android:textSize="16sp" />

    </com.google.android.material.textfield.TextInputLayout>

    <com.google.android.material.button.MaterialButton
        android:id="@+id/activity_comment_apply_button"
        style="@style/CommentApplyButton"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="@string/comment_activity_button_apply"
        app:layout_constraintBottom_toTopOf="@id/bottom_guideline"
        app:layout_constraintEnd_toEndOf="@id/right_guideline"
        app:layout_constraintStart_toEndOf="@id/left_guideline" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/bottom_guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        app:layout_constraintGuide_end="16dp" />

</androidx.constraintlayout.widget.ConstraintLayout> ```

Manifest file:

```         <activity
            android:name=".MainActivity"
            android:windowSoftInputMode="stateVisible|adjustResize"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity> ```
0 Answers
Related