3
respostas

Problemas com o ScrollView, não estou conseguindo fazer funcionar no andriod 3.0.1

<?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ScrollView 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"
    tools:context="br.com.alura.agenda2.FormularioActivity">

    <ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:layout_editor_absoluteY="81dp">

        <EditText
            android:id="@+id/edtNome"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:hint="Nome"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <EditText
            android:id="@+id/edtEndereco"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:hint="Endereço"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/edtNome" />

        <EditText
            android:id="@+id/edtTelefone"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:hint="Telefone"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/edtEndereco" />

        <EditText
            android:id="@+id/edtSite"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:hint="Site"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/edtTelefone" />

        <RatingBar
            android:id="@+id/ratingBar"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="8dp"
            android:max="10"
            android:numStars="5"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.0"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/edtSite" />

        <Button
            android:id="@+id/btnSalvar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:text="Salvar"
            app:layout_constraintTop_toBottomOf="@+id/ratingBar"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteX="16dp" />

    </ConstraintLayout>

</android.support.constraint.ScrollView>
3 respostas

Fala ai Marcos, de boa ?

Acho que o problema está sendo o ConstraintLayout que está usando, troca por LinearLayout, que deve funcionar.

Boa noite, não sei mais o que fazer pois LinearLayout não funciona, a tela fica cinza e não funciona nada.

<ScrollView>
    <LinearLayout>
        <!-- restante do conteudo -->
    </LinearLayout>
</ScrollView>

Lembrando que precisa ter toda a parte de tamanho.