我正在尝试使用约束布局链将两个文本视图垂直居中。我知道我可以将文本布局包装在线性布局中,但我想尝试新的链功能。当我构建我的项目时,虽然我得到了一个错误,Error:(28, 50) No resource found that matches the given name (at 'layout_constraintBottom_toTopOf' with value '@id/item_school_location').
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="72dp">
<ImageView
android:id="@+id/item_school_logo"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
android:contentDescription="@string/item_school_logo_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
<TextView
android:id="@+id/item_school_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="72dp"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Light.SearchResult.Subtitle"
app:layout_constraintBottom_toTopOf="@id/item_school_location"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5"
app:layout_constraintVertical_chainPacked="true" />
<TextView
android:id="@+id/item_school_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="72dp"
android:maxLines="1"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/item_school_name" />
</android.support.constraint.ConstraintLayout>
</layout>
有谁知道是什么导致了这个错误?