I have a custom view made up of 3 elements.
I want the view to be adaptive to the size available to it.
I want it to look like .
But to get it to look like this I had to add hard coded size constraints thus making it none adaptive.
This is how it looks using match_constraint on all image views (not the way I want it to look like ):
And here is the xml layout.
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.avimarine.boatangels.activities.InspectionResultActivity"
tools:visibility="visible">
<ImageView
android:id="@+id/moored_boat_bowlines"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/boat_drawing_content_description"
app:layout_constraintBottom_toTopOf="@+id/moored_boat_body"
app:layout_constraintEnd_toEndOf="@+id/moored_boat_body"
app:layout_constraintStart_toStartOf="@+id/moored_boat_body"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_monohull_mooring_bow"
tools:visibility="visible"/>
<ImageView
android:id="@+id/moored_boat_body"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/boat_drawing_content_description"
app:layout_constraintBottom_toTopOf="@+id/moored_boat_sternlines"
app:layout_constraintDimensionRatio="h,1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/moored_boat_bowlines"
app:layout_constraintVertical_chainStyle="spread_inside"
app:srcCompat="@drawable/ic_top_mv"
tools:visibility="visible"/>
<ImageView
android:id="@+id/moored_boat_sternlines"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:contentDescription="@string/boat_drawing_content_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/moored_boat_body"
app:layout_constraintStart_toStartOf="@+id/moored_boat_body"
app:layout_constraintTop_toBottomOf="@+id/moored_boat_body"
app:srcCompat="@drawable/ic_monohull_dock_aft"
tools:visibility="visible"/>
</android.support.constraint.ConstraintLayout>
</merge>
How do I make this adaptive and still look like the first image?