I have a horizontal RecyclerView inside a ConstraintLayout. I want to place a button at the end of the RecyclerView. When the recycler is empty, the button should expand to all available space. When items are added to the recycler, the button should squeeze down to a minimum.
There are some new additions to ConstraintLayout 1.1.0, like layout_constraintWidth_min
, but I don't get it working. Is it supposed to work the way I intend?
Here are the relevant attributes, not including height:
<android.support.v7.widget.RecyclerView
android:id="@+id/horizontal_recycler"
android:layout_width="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/add">
</android.support.v7.widget.RecyclerView>
and
<Button
android:id="@+id/add"
android:layout_width="0dp"
app:layout_constraintWidth_min="80dp"
app:layout_constraintStart_toEndOf="@+id/horizontal_recycler"
app:layout_constraintEnd_toEndOf="parent">
</Button>