Much Overflow
Much Overflow

Reputation: 3140

ConstraintLayout last view is getting cropped

In my layout, the last view (Blue Text) is getting cropped like shown in the image below.

enter image description here

I have my ConstraintLayout setup like follows

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

   <ImageView
        android:id="@+id/ivIcon"
        android:layout_width="24dp"
        android:layout_height="24dp"
        android:layout_marginEnd="10dp"
        android:layout_marginTop="10dp"
        android:background="@color/blue"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <TextView
        android:id="@+id/tvMain"
        style="@style/ActorTextMainOne"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="20dp"
        android:layout_marginTop="28dp"
        android:text="28"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <TextView
        android:id="@+id/tvSecondaryOne"
        style="@style/ActorTextSecondary"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="4dp"
        android:text="Jun"
        app:layout_constraintBottom_toTopOf="@+id/tvSecondaryTwo"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/tvMain"/>

    <TextView
        android:id="@+id/tvSecondaryTwo"
        style="@style/ActorTextSecondary"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginBottom="12dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="4dp"
        android:text="2017"
        app:layout_constraintBottom_toBottomOf="@+id/tvMain"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/tvMain"/>

    <TextView
        android:id="@+id/tvDescription"
        style="@style/ActorTextDescription"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginTop="4dp"
        android:text="@string/arrival_date"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/tvMain"
        app:layout_constraintTop_toBottomOf="@+id/tvSecondaryTwo"/>

</android.support.constraint.ConstraintLayout>

ConstraintLayout version being used is 1.0.2

I think I am missing something obvious here but I am unable to figure it out. How can I make the blue text at the bottom fully visible while keeping the ConstraintLayout's height to wrap_content?

Upvotes: 3

Views: 922

Answers (1)

Raghunandan
Raghunandan

Reputation: 133560

Try Changing

app:layout_constraintTop_toBottomOf="@+id/tvSecondaryTwo"

to

app:layout_constraintTop_toBottomOf="@+id/tvMain"

for textview with id tvDescription

This makes the textview with id tvDescription to be below the textview with id tvMain.

Upvotes: 1

Related Questions