How to set the maximum width of a view in android constraintLayout?
Set the maximum width of the view in constraintLayout
SeekBar, with a max width value of 200dp, keeps the parent's left and right constraints and a width of 0dp, it will stretch the width of the view to 200dp, but if there is more room, it will stay at 200dp.
<SeekBar
...
android:layout_width="0dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintWidth_max="200dp" />
dynamic settings
ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(0, 0);
layoutParams.matchConstraintMaxWidth = ...