I have three views lined up horizontally in a ConstraintLayout. I need the center view to be anchored to the center of the parent. The tricky part is that all three views have dynamic widths.
If I constrain the center view horizontally to the two views at the ends, the center view will not be centered relative to the parent if the other two views have different widths. Instead it will be centered in the free space between the two views.
If I constrain the center view horizontally to the parent, it will be centered relatively to the parent. However, the center view can then grow wide enough to overlap with the two views at the ends.
I need to be able to anchor the center view while at the same time bounding its width so that it cannot overlap with the two views at the end.
I have tried this with LinearLayout, RelativeLayout, and ConstraintLayout, but none of them seems to be able to satisfy both of the criteria.
Any help would be appreciated!