How to change layout_gravity in ConstraintLayout programmatically?

784 views Asked by At

I got an XML file that includes a ConstraintLayout and inside this layout i got three views. The layout as its width set to "wrap_content" which automatically wrap it to the left side like this:

enter image description here

in the XML edit window, when i set layout_gravity to the right, it moves the layout to the right as expected:

enter image description here

I'm trying to achieve the same layout_gravity movement to right but programmatically (in Java) but i can not find any way to do it.

0

There are 0 answers