www.state-it.info

Gran base de respuestas a las preguntas de los desarrolladores
Header decor

Como cambiar el tamaño de las ConstraintLayout durante el funcionamiento de la aplicación?

MrNiiik 2018-11-06 20:32:52

necesito a una determinada condición de limpiar (height = 0) secundario ConstraintLayout, y luego volvió a mostrar (height = match_constraint). Lo he probado así:

Borrar:

val c = ConstraintSet()
                c.clone(constraintLayoutTable)
                c.constrainMaxHeight(R.id.constraintLayoutTableTitle, 0)
                c.constrainPercentHeight(R.id.constraintLayoutTableTitle, 0.0f)
                c.applyTo(constraintLayoutTable)


Devolver:


val c = ConstraintSet()
                c.clone(constraintLayoutTable)
                c.constrainHeight(R.id.constraintLayoutTableTitle, ConstraintSet.MATCH_CONSTRAINT)
                c.constrainMaxHeight(R.id.constraintLayoutTableTitle, 100)
                c.constrainPercentHeight(R.id.constraintLayoutTableTitle, 100.0f)
                c.applyTo(constraintLayoutTable)


Estos métodos no funcionan.

El formato del constraintLayoutTableTitle

<android.support.constraint.ConstraintLayout
        android:id="@+id/constraintLayoutTableTitle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <TextView
            android:id="@+id/textView13"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="12dp"
            android:layout_marginBottom="8dp"
            android:text="I"
            android:textSize="24sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="I" />

        <TextView
            android:id="@+id/textView14"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="8dp"
            android:layout_marginTop="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="8dp"
            android:text="Test"
            android:textSize="24sp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/textView13"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    </android.support.constraint.ConstraintLayout>

Beshere 2018-11-07 08:51:53

Y findViewByID no funciona con contenedores?


Total answers: 0

Preguntas relacionadas:

Footer decor

© www.state-it.info | Base of answers to questions for developers and programmers.