0

como na imagem https://i.sstatic.net/67oZ4.jpg, o progressbar está atrás dos elementos.

<ImageView
        android:id="@+id/imgModoAuto"
        android:foregroundGravity="center_horizontal"
        android:layout_width="match_parent"
        android:layout_marginTop="20dp"
        android:src="@drawable/modo_transito_crop"
        android:layout_height="120dp"/>


<ScrollView
        android:layout_below="@id/imgModoAuto"
        android:layout_width="match_parent"
        android:id="@+id/scrollview"
        android:layout_height="446dp"
        android:layout_marginTop="10dp"
        tools:context=".fragment.LoginFragment">

    <RelativeLayout
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:id="@+id/relative">


        <LinearLayout android:layout_width="match_parent"
                      android:orientation="vertical"
                      android:id="@+id/linearLayout"
                      android:layout_height="match_parent">

            <TextView android:id="@+id/txtLogin"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:text="@string/login"
                      android:textColor="@color/white"
                      android:gravity="center"
                      android:textStyle="bold"
                      android:textSize="20sp"/>

        </LinearLayout>

        <ProgressBar
                android:id="@+id/progress_bar_login"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_centerInParent="true"
                android:visibility="visible" />



        <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/edtEmail"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_below="@id/linearLayout"
                android:layout_width="match_parent"
                android:layout_marginStart="40dp"
                android:layout_marginEnd="40dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/edit_text_box"
                app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
                android:layout_height="wrap_content">

            <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/etLogin"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/edit_text_box"
                    android:hint="@string/email"
                    android:textCursorDrawable="@drawable/color_cursor"
                    android:inputType="textEmailAddress"/>

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


        <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/edtSenha"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_marginStart="40dp"
                android:layout_marginEnd="40dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/edit_text_box"
                app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
                android:layout_height="wrap_content"
                app:passwordToggleEnabled="true"
                android:layout_below="@id/edtEmail">

            <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/etPassword"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/edit_text_box"
                    android:hint="@string/senha"
                    android:textCursorDrawable="@drawable/color_cursor"
                    android:inputType="textPassword" android:layout_alignBottom="@+id/edtSenha"/>

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

        <Button android:id="@+id/btnEntrar"
                android:layout_width="match_parent"
                android:layout_below="@id/edtSenha"
                android:layout_marginStart="40dp"
                android:layout_marginTop="20dp"
                android:layout_marginEnd="40dp"
                android:text="@string/entrar"
                android:padding="20dp"
                android:textColor="@color/white"
                android:background="@drawable/form_button"
                android:layout_height="wrap_content"/>


        <LinearLayout
                android:id="@+id/relOpcoes"
                android:layout_below="@id/btnEntrar"
                android:layout_width="match_parent"
                android:gravity="center_horizontal"
                android:orientation="horizontal"
                android:foregroundGravity="center_horizontal"
                android:layout_height="match_parent">

            <Button android:layout_width="wrap_content"
                    android:text="@string/esqueci_senha"
                    android:layout_marginTop="10dp"
                    android:textColor="@color/white"
                    android:id="@+id/btnEsqueceuSenha"
                    android:background="@drawable/form_button_white"
                    android:paddingStart="20dp"
                    android:paddingEnd="20dp"
                    android:paddingBottom="15dp"
                    android:paddingTop="15dp"
                    android:layout_marginEnd="20dp"
                    android:layout_height="wrap_content"/>

            <Button android:layout_width="wrap_content"
                    android:id="@+id/btnSignUp"
                    android:background="@drawable/form_button_white"
                    android:text="@string/cadastre_se"
                    android:textColor="@color/white"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:paddingStart="20dp"
                    android:paddingEnd="20dp"
                    android:paddingBottom="15dp"
                    android:paddingTop="15dp"/>


        </LinearLayout>




        <TextView android:id="@+id/txtEntrecom"
                  android:layout_width="match_parent"
                  android:text="@string/ou_entre_com"
                  android:layout_centerInParent="true"
                  android:layout_marginTop="10dp"
                  android:textSize="14sp"
                  android:textColor="@color/white"
                  android:gravity="center_horizontal"
                  android:layout_below="@id/relOpcoes"
                  android:layout_height="wrap_content"/>


        <LinearLayout android:layout_width="match_parent"
                      android:layout_below="@id/txtEntrecom"
                      android:orientation="horizontal"
                      android:id="@+id/lilBotoesSociais"
                      android:gravity="center_horizontal"
                      android:layout_height="match_parent">


            <ImageButton
                    android:id="@+id/imbFacebook"
                    android:layout_width="56dp"
                    android:background="@drawable/fab_facebook"
                    android:layout_height="56dp"
                    android:layout_marginTop="10dp"/>


            <ImageButton
                    android:id="@+id/google_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/fab_google"
                    android:layout_marginStart="20dp"
                    android:layout_marginTop="10dp"/>

        </LinearLayout>


    </RelativeLayout>

</ScrollView>

<ImageView
        android:id="@+id/imageDpVat"
        android:layout_below="@id/scrollview"
        android:layout_marginTop="10dp"
        android:background="@drawable/curva_inferior_branca"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

1
  • No XML, o último elemento do nó pai fica por cima dos demais. Commented 12/09/2019 às 6:44

1 Resposta 1

0

Seguindo o comentário do @Valdeir Psr o ultimo elemento do pai sobrepõe os demais. Sendo assim, basta reposicionar seu progressBar circular dentro do RelativeLayout contido no ScrowView para a ultima posição (Último elemento a ser declarado). Fazendo seu código ficar assim:

<ImageView
        android:id="@+id/imgModoAuto"
        android:foregroundGravity="center_horizontal"
        android:layout_width="match_parent"
        android:layout_marginTop="20dp"
        android:src="@drawable/modo_transito_crop"
        android:layout_height="120dp"/>


<ScrollView
        android:layout_below="@id/imgModoAuto"
        android:layout_width="match_parent"
        android:id="@+id/scrollview"
        android:layout_height="446dp"
        android:layout_marginTop="10dp"
        tools:context=".fragment.LoginFragment">

    <RelativeLayout
            android:layout_height="wrap_content"
            android:layout_width="match_parent"
            android:id="@+id/relative">


        <LinearLayout android:layout_width="match_parent"
                      android:orientation="vertical"
                      android:id="@+id/linearLayout"
                      android:layout_height="match_parent">

            <TextView android:id="@+id/txtLogin"
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:text="@string/login"
                      android:textColor="@color/white"
                      android:gravity="center"
                      android:textStyle="bold"
                      android:textSize="20sp"/>

        </LinearLayout>

        <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/edtEmail"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_below="@id/linearLayout"
                android:layout_width="match_parent"
                android:layout_marginStart="40dp"
                android:layout_marginEnd="40dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/edit_text_box"
                app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
                android:layout_height="wrap_content">

            <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/etLogin"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/edit_text_box"
                    android:hint="@string/email"
                    android:textCursorDrawable="@drawable/color_cursor"
                    android:inputType="textEmailAddress"/>

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


        <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/edtSenha"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_marginStart="40dp"
                android:layout_marginEnd="40dp"
                android:layout_marginTop="20dp"
                android:background="@drawable/edit_text_box"
                app:hintTextAppearance="@style/TextAppearance.App.TextInputLayout"
                android:layout_height="wrap_content"
                app:passwordToggleEnabled="true"
                android:layout_below="@id/edtEmail">

            <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/etPassword"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/edit_text_box"
                    android:hint="@string/senha"
                    android:textCursorDrawable="@drawable/color_cursor"
                    android:inputType="textPassword" android:layout_alignBottom="@+id/edtSenha"/>

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

        <Button android:id="@+id/btnEntrar"
                android:layout_width="match_parent"
                android:layout_below="@id/edtSenha"
                android:layout_marginStart="40dp"
                android:layout_marginTop="20dp"
                android:layout_marginEnd="40dp"
                android:text="@string/entrar"
                android:padding="20dp"
                android:textColor="@color/white"
                android:background="@drawable/form_button"
                android:layout_height="wrap_content"/>


        <LinearLayout
                android:id="@+id/relOpcoes"
                android:layout_below="@id/btnEntrar"
                android:layout_width="match_parent"
                android:gravity="center_horizontal"
                android:orientation="horizontal"
                android:foregroundGravity="center_horizontal"
                android:layout_height="match_parent">

            <Button android:layout_width="wrap_content"
                    android:text="@string/esqueci_senha"
                    android:layout_marginTop="10dp"
                    android:textColor="@color/white"
                    android:id="@+id/btnEsqueceuSenha"
                    android:background="@drawable/form_button_white"
                    android:paddingStart="20dp"
                    android:paddingEnd="20dp"
                    android:paddingBottom="15dp"
                    android:paddingTop="15dp"
                    android:layout_marginEnd="20dp"
                    android:layout_height="wrap_content"/>

            <Button android:layout_width="wrap_content"
                    android:id="@+id/btnSignUp"
                    android:background="@drawable/form_button_white"
                    android:text="@string/cadastre_se"
                    android:textColor="@color/white"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:paddingStart="20dp"
                    android:paddingEnd="20dp"
                    android:paddingBottom="15dp"
                    android:paddingTop="15dp"/>


        </LinearLayout>




        <TextView android:id="@+id/txtEntrecom"
                  android:layout_width="match_parent"
                  android:text="@string/ou_entre_com"
                  android:layout_centerInParent="true"
                  android:layout_marginTop="10dp"
                  android:textSize="14sp"
                  android:textColor="@color/white"
                  android:gravity="center_horizontal"
                  android:layout_below="@id/relOpcoes"
                  android:layout_height="wrap_content"/>


        <LinearLayout android:layout_width="match_parent"
                      android:layout_below="@id/txtEntrecom"
                      android:orientation="horizontal"
                      android:id="@+id/lilBotoesSociais"
                      android:gravity="center_horizontal"
                      android:layout_height="match_parent">


            <ImageButton
                    android:id="@+id/imbFacebook"
                    android:layout_width="56dp"
                    android:background="@drawable/fab_facebook"
                    android:layout_height="56dp"
                    android:layout_marginTop="10dp"/>


            <ImageButton
                    android:id="@+id/google_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/fab_google"
                    android:layout_marginStart="20dp"
                    android:layout_marginTop="10dp"/>

        </LinearLayout>


        <ProgressBar
                android:id="@+id/progress_bar_login"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_centerInParent="true"
                android:visibility="visible" />


    </RelativeLayout>

</ScrollView>

<ImageView
        android:id="@+id/imageDpVat"
        android:layout_below="@id/scrollview"
        android:layout_marginTop="10dp"
        android:background="@drawable/curva_inferior_branca"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>

Assim como nas classe Java, o código em xml é percorrido de cima para baixo.

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .