johnrao07
johnrao07

Reputation: 6908

Centre a view with respect to above view in ConstraintLayout

enter image description here

As you can see, the 3rd one, bottom view is right aligned, I want it to align centre to the above view. I don't want to group them together as I think there is a possible alternate solution

I don't think code is necessary here, If you need, pls comment below

Upvotes: 0

Views: 24

Answers (2)

Md Hanif
Md Hanif

Reputation: 1107

You can try this :-

app:layout_constraintEnd_toEndOf="@+id/YourTopView" app:layout_constraintStart_toStartOf="@+id/YourTopView"

and make width as wrap content. This will work.

Upvotes: 1

Shubham Rohila
Shubham Rohila

Reputation: 411

Contraint the bottom view's left and right with the left and right of the view above it respectively. Also contraint the top of bottom view with the bottom of the above view. This should help you out.

Upvotes: 0

Related Questions