TextView внутри текста клипов ConstraintLayout

Я столкнулся со странным поведением TextView внутри ConstraintLayout.

TextView обрезает текст. На скриншоте вы видите три варианта:

  1. TextView имеет width = "match_parent" - границы правильные, но текст обрезан;

  2. TextView имеет width = "wrap_content" - неправильные границы и текст снова обрезается;

  3. TextView внутри LinearLayout - это пример того, как должно было быть.

введите здесь описание изображения

ConstraintLayout, что с тобой?


Вот мой XML-макет.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
    android:background="#727272"
    android:orientation="vertical"
    android:padding="16dp">

    <android.support.constraint.ConstraintLayout
        android:id="@+id/block"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:padding="16dp">

        <ImageView
            android:id="@+id/img"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:background="#000000"
            app:layout_constraintLeft_toLeftOf="@+id/block"
            app:layout_constraintTop_toTopOf="@+id/block" />

        <TextView
            android:id="@+id/text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:background="#cccccc"
            android:padding="6dp"
            android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
            app:layout_constraintLeft_toRightOf="@+id/img"
            app:layout_constraintRight_toRightOf="@+id/block"
            app:layout_constraintTop_toTopOf="@+id/img" />

    </android.support.constraint.ConstraintLayout>

    <android.support.constraint.ConstraintLayout
        android:id="@+id/block2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:padding="16dp">

        <ImageView
            android:id="@+id/img2"
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:background="#000000"
            app:layout_constraintLeft_toLeftOf="@+id/block2"
            app:layout_constraintTop_toTopOf="@+id/block2" />

        <TextView
            android:id="@+id/text2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:background="#cccccc"
            android:padding="6dp"
            android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
            app:layout_constraintLeft_toRightOf="@+id/img2"
            app:layout_constraintRight_toRightOf="@+id/block2"
            app:layout_constraintTop_toTopOf="@+id/img2" />

    </android.support.constraint.ConstraintLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:orientation="horizontal"
        android:padding="16dp">

        <ImageView
            android:layout_width="60dp"
            android:layout_height="60dp"
            android:background="#000000" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:background="#cccccc"
            android:padding="6dp"
            android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." />

    </LinearLayout>


person MaxF    schedule 02.09.2016    source источник
comment
какая ConstraintLayout версия?   -  person Harshad Pansuriya    schedule 02.09.2016
comment
@Ironman 'com.android.support.constraint: constraint-layout: 1.0.0-alph‌ a4'   -  person MaxF    schedule 02.09.2016


Ответы (1)


Хорошо, это известная ошибка, и как обещал Google

Выпущено в альфе 5

https://code.google.com/p/android/issues/detail?id=215537

person MaxF    schedule 02.09.2016