Appbar overlapping the content of the rest of Activity

Asked

Viewed 169 times

0

I’m doing some exercises but when it comes to executing, the bar is always on top of the content of Activity.

Print of how you are for now

inserir a descrição da imagem aqui

Below goes my file content_formulario.xml :

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

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

        <EditText
            android:hint="Nome"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:hint="Endereço"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:hint="Telefone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:hint="Site"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <RatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:numStars="5"
            android:max="10"
            android:layout_gravity="center"/>

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Salvar"/>

    </LinearLayout>
</ScrollView>

Does anyone know how I can fix this? Thank you.

  • Naldson, could you put your styles.xml?

1 answer

0

Try it this way:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="1dp"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical">
<ScrollView
    android:layout_height="match_parent"
    android:layout_width="match_parent">

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

        <EditText
            android:hint="Nome"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:hint="Endereço"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:hint="Telefone"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <EditText
            android:hint="Site"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <RatingBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:numStars="5"
            android:max="10"
            android:layout_gravity="center"/>

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Salvar"/>

    </LinearLayout>
</ScrollView>
</LinearLayout>

We need to add a Layout to hold Screen components.

Browser other questions tagged

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