aurelhubert / ahbottomnavigation

A library to reproduce the behavior of the Bottom Navigation guidelines from Material Design.
3.84k stars 683 forks source link

ConstraintLayout animation problem #401

Closed TooLazyy closed 5 years ago

TooLazyy commented 5 years ago

Hi. I have a ConstraintLayoutL with a navigation at bottom. In some cases i need to hide a bottom navigation with ConstraintLayout animation.

Layout file:

<android.support.constraint.ConstraintLayout
        android:id="@+id/lMainConstraint"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
. . .
toolbar and others views
. . .
<View
            android:id="@+id/temp"
            android:layout_width="match_parent"
            android:layout_height="0.1dp"
            app:layout_constraintBottom_toBottomOf="parent" />

<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
                android:id="@+id/vNavigation"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>

To hide navigation by sliding to bottom:

val newSet = ConstraintSet()
        newSet.clone(mInitialSet)
        newSet.connect(R.id.toolbar, ConstraintSet.BOTTOM, R.id.temp, ConstraintSet.TOP)
        newSet.connect(R.id.vNavigation, ConstraintSet.TOP, R.id.temp2, ConstraintSet.BOTTOM)

        val transition = AutoTransition()
        transition.interpolator = AccelerateInterpolator()
        transition.duration = 250
        TransitionManager.beginDelayedTransition(lMainConstraint, transition)
        newSet.applyTo(lMainConstraint)

However, vNavigation hiding by half only. My R.id.toolbar at top hiding completely, any other ViewGroup hiding without any problems. Library version - 2.2.0 (cannot user 28 api) P.S. - putting AHBottomNavigation into LinearLayout or any other make no sense

TooLazyy commented 5 years ago

Forget it, my bad. Need to clear vNavigation bottom constraint)