Screen and Keyboard Settings

Asked

Viewed 396 times

1

Well, I have a certain difficulty: I created a form in android studio to insert some information, as in figure 1.

imagem 1

In all fields, I can enter the information smoothly. However, when I enter the last field (whose hint is "enter a description of your event"), the keyboard covers the view, and I can’t see what is being typed, but the typed text is inserted, and I can visualize when I recoil the keyboard. (Figure 2)

imagem 2 .

I even tried to put a Scroll View covering the whole page, but it didn’t work. Someone has the solution?

The xml code is attached

<Spinner
    android:id="@+id/tipoDeEvento"
    android:layout_width="368dp"
    android:layout_height="40dp"
    android:layout_marginTop="16dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/cidadeEvento" />

<EditText
    android:id="@+id/nomeDoEvento"
    android:layout_width="368dp"
    android:layout_height="40dp"
    android:layout_marginTop="32dp"
    android:ems="10"
    android:hint="Insira o nome de seu evento"
    android:inputType="textPersonName"
    android:textSize="18sp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<EditText
    android:id="@+id/logradouroEvento"
    android:layout_width="368dp"
    android:layout_height="40dp"
    android:layout_marginTop="17dp"
    android:ems="10"
    android:hint="Insira o endereco do seu evento"
    android:inputType="textPersonName"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/nomeDoEvento" />

<EditText
    android:id="@+id/cidadeEvento"
    android:layout_width="368dp"
    android:layout_height="40dp"
    android:layout_marginTop="16dp"
    android:ems="10"
    android:hint="Insira a cidade de seu evento"
    android:inputType="textPersonName"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/logradouroEvento" />

<Spinner
    android:id="@+id/estadoEvento"
    android:layout_width="90dp"
    android:layout_height="40dp"
    android:layout_marginLeft="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="16dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/tipoDeEvento" />

<Button
    android:id="@+id/botaoSalvarEvento"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:text="Salvar"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/scrollView3"
    android:layout_marginRight="8dp"
    app:layout_constraintRight_toRightOf="parent"
    android:layout_marginEnd="8dp" />

<ScrollView
    android:id="@+id/scrollView3"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="16dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/estadoEvento"
    android:fadeScrollbars="false"
    android:layout_marginLeft="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginStart="8dp"
    android:layout_marginEnd="8dp">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <EditText
            android:id="@+id/descricaoEvento"
            android:layout_width="match_parent"
            android:layout_height="117dp"
            android:layout_marginEnd="8dp"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginTop="16dp"
            android:ems="10"
            android:hint="Insira uma descrição de seu evento"
            android:inputType="textMultiLine"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/estadoEvento" />
    </LinearLayout>
</ScrollView>

<Spinner
    android:id="@+id/valorEvento"
    android:layout_width="265dp"
    android:layout_height="40dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginTop="16dp"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/tipoDeEvento" />

  • ta using the constraintlayout or the relativelayout?

1 answer

0


I usually use the attribute windowSoftInputMode passing by adjustPan as parameter. See:

android:windowSoftInputMode="adjustPan"

Add this to your AndroidManifest.xml, in Activity in which is the EditText. Behold:

<activity
        android:name=".ActivityMain"
        ...
        android:windowSoftInputMode="adjustPan"
        />
  • I’m sorry, but where do I put it? My Manifest:

  • 1

    @Luíscarlos yes, in Androidmanifest.xml, in his Activity where Edittext is located.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.