I have a ConstraintLayout inside a NestedScrollView . ConstraintLayout contains a bunch of views, but the last View can have a dynamic height to fill the bottom space if there is one, but it should also be a minimum height if there is not enough space.
For arguments, here is an example.
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <android.support.constraint.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" tools:layout_height="match_parent"> <View android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintHeight_min="1500dp" android:background="@color/red" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintTop_toTopOf="parent"/> </android.support.constraint.ConstraintLayout> </android.support.v4.widget.NestedScrollView>
As you can see, I have included the ConstraintLayout version, but it does not work. Obviously, the values โโare ridiculously large, but it's just for testing.
If I do not set fillViewport="true" in NestedScrollView , then ConstraintLayout has a height of 0. When I set fillViewport , ConstraintLayout does not scroll, it just fills the screen.
How can I set the view so that it extends to the bottom of the ConstraintLayout , which should be the size of the Viewport, but if my view is not minHeight , then we allow scrolling?
I am using version 1.0.2 the ConstraintLayout library.
What I expect to see is to be up to the end of the parent, but if this size is less than 1500dp , then the view scrolls.
I entered 1500dp, like android:layout_height="1500dp" , and the view scrolls accordingly.
UPDATE 1
It seems I once posted a layout in a FragmentViewPager . The app:layout_constraintHeight_min not respected and only matches the height of the viewport.
I also tried pulling the NestedScrollView from the fragment and pasting the ViewPager inside it, but was not working again.