저는 RecyclerView 내부의 ViewHolder에 대한 XML 레이아웃을 가지고 있습니다.ConstraintLayout beta5 wrap_content가 제대로 랩되지 않습니다.
이 레이아웃의 루트는 높이가 wrap_content
으로 설정된 ConstraintLayout입니다.
이 평면 계층에는 3 개의 텍스트 뷰와 고정 된 높이의 이미지 뷰가 있습니다. 생각해 :
<ConstraintLayout>
<TextView height=wrap>
<TextView height=wrap>
<TextView height=wrap>
<ImageView height=150dp>
</ConstraintLayout>
비교적 간단한 레이아웃입니다. 은 "빨간 테이프"에 대한
죄송하지만 NDA ㅋ ㅋ ㅋ ㅋ이다 : beta4
이는 (결국 실행시, 각 recyclerView 세포) 디자이너의 모습입니다.
말했다되고 있다는 요소는 다음과 같습니다
3 텍스트 뷰 (빨간색이 좋은 보라색 배경에 테이프) 150dp 높이가 이미지 뷰는 회색 것입니다.
보라색 배경이 루트 ConstraintLayout에 적용되었습니다. 좋아.
지금이는 베타 5와 하나의 수정없이 모습입니다 :
당신은 퍼플 (루트) 제약 레이아웃은 지금 "혼란"하고 내용을 포장하지 않습니다 볼 수 있듯이 이전처럼.
것들 내가 시도 :
는 ConstraintLayout에
app:layout_constraintHeight_default="wrap"
추가 (너무 확산). 차이를 만들지 않았다.ImageView에 제거하려고 시도한제약이 있습니다. 차이를 만들지도 않았습니다.
되돌리기 다시 beta4에 :)
공식적으로,이 전체 레이아웃은 (의 빨간색 테이프 이유로 이름이 변경되었습니다 ID와 도구를 사용하지 않고 : 때문에 같은 이유에 텍스트 또는 이와 유사한 것) . 그렇지 않으면 레이아웃은 완전히 동일합니다.
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent">
<TextView
android:id="@+id/toplabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text=""
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/top_bottom_label"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@+id/top_right_label"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/top_right_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:gravity="end"
android:maxLines="1"
android:text=""
app:layout_constraintBottom_toTopOf="@+id/top_bottom_label"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toRightOf="@+id/toplabel"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/top_bottom_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:ellipsize="end"
android:gravity="end"
android:maxLines="1"
android:text=""
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toRightOf="@+id/toplabel"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top_right_label" />
<ImageView
android:id="@+id/imageview"
android:layout_width="0dp"
android:layout_height="150dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top_bottom_label"
app:srcCompat="@android:color/darker_gray" />
</android.support.constraint.ConstraintLayout>
뭔가 다른 것을해야하나요? (나는이 RelativeLayout의와 이것을 대체 할 수있어 아마도 동일한 기능을 수행하지만, 어쨌든 ... 내가 ConstraintLayout에서 믿을 !) :