Yes, this is possible (as long as you know your images aren't so wide that they will overlap, and as long as Image2 and Image3 are the same width).
Positioning Image1 and Image4 is easy; you can just constrain their outside edges to the outside edges of the parent.
Then use these constraints to position Image2's right-hand edge to the exact center of the parent:
app:layout_constraintRight_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
and these constraints to position Image3's left-hand edge to the exact center:
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintLeft_toRightOf="parent"
Update
If you know in advance that Image2 and Image3 are not the same width, and you need the combination of the two to be centered, then (as far as I'm aware) you can only solve this problem by introducing an intermediate parent (e.g. a LinearLayout
).
In this case, you'd position Image1 and Image4 to the parent edges as before, and use these constraints to "center" the LinearLayout
inside the ConstraintLayout
:
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
Then you simply place Image2 and Image3 inside this LinearLayout
.