Ive got a view like below :
Here is what I did (no need for ConstraintSet
, we can work directly on the constraints themselves):
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) myView.getLayoutParams();
params.horizontalBias = 0.2f; // here is one modification for example. modify anything else you want :)
myView.setLayoutParams(params); // request the view to use the new modified params
it worked like a charm when I had a SeekBar
and a TextView
below it (aligned to it both left+right), and I wanted to update the TextView
position to be under the SeekBar
's cursor, so I had to update the horizontal bias params on the SeekBar
's OnSeekBarChangeListener