How to make a superposition in a constraint layout?

0

well what happens I can show it in images

login

load view

You can clearly see the problem that the constraint does not take into account the overlay and I can focus the edittext even though the load view is above it.

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ViewSwitcher
        android:id="@+id/vsini"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <android.support.constraint.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="INICIAR SESIÓN"
                android:textSize="30sp"
                android:textStyle="bold"
                android:textAlignment="center"
                android:padding="10dp"
                android:background="@color/colorPrimary"
                android:textColor="#FAFAFA"
                android:elevation="5dp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintLeft_toLeftOf="parent"
                android:layout_marginStart="8dp"
                android:layout_marginEnd="8dp" />
            <EditText
                android:id="@+id/nomusu"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="text"
                android:hint="Nombre usuario"
                android:padding="10dp"
                android:textSize="25sp"
                app:layout_constraintTop_toTopOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp" />
            <EditText
                android:id="@+id/pasusu"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:inputType="textPassword"
                android:hint="Contraseña"
                android:padding="10dp"
                android:textSize="25sp"
                app:layout_constraintTop_toBottomOf="@+id/nomusu"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp" />
            <Button
                android:id="@+id/ingresar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Ingresar"
                android:background="@color/colorAccent"
                android:textColor="#FAFAFA"
                android:textSize="20sp"
                android:padding="10dp"
                app:layout_constraintTop_toBottomOf="@+id/pasusu"
                app:layout_constraintRight_toRightOf="parent"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="____________"
                android:padding="10dp"
                android:textColor="@color/colorPrimaryDark"
                app:layout_constraintTop_toTopOf="@+id/registro"
                app:layout_constraintLeft_toLeftOf="@+id/registro"
                android:layout_marginTop="5dp" />
            <TextView
                android:id="@+id/registro"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Registrarse >>"
                android:padding="10dp"
                android:textColor="@color/colorPrimaryDark"
                app:layout_constraintTop_toBottomOf="@+id/ingresar"
                app:layout_constraintRight_toRightOf="parent"
                android:layout_marginTop="8dp"
                android:layout_marginRight="8dp"
                android:layout_marginLeft="8dp"  />
        </android.support.constraint.ConstraintLayout>
        <LinearLayout ...>
    </ViewSwitcher>
    <LinearLayout
        android:id="@+id/load"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:background="#EEEEEE">
        <ImageView
            android:id="@+id/fav"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/favicon"
            android:contentDescription="load"/>
    </LinearLayout>

</android.support.constraint.ConstraintLayout>
    
asked by junior 11.09.2018 в 20:55
source

1 answer

0

When you are in the second view you can leave the set of components with GONE visibility. Example:

nomusu.setVisibility(View.GONE);

You can use it with a linearlayout or a realativelayout or others, you just have to assign an id to the container and give it that property while you show the other, in this way you can hide entire sets of components.

    
answered by 11.09.2018 в 23:23