我有以下文本视图,它应该包含自动调整大小的文本。
<TextView
android:layout_width="0dp"
android:layout_height="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tabRecyclerView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="@color/lightshade"
android:text="@string/add_favorites_message"
android:gravity="center"
android:minLines="2"
android:maxLines="2"
app:autoSizeTextType="uniform"/>
但是,我收到关于最后一行的错误“意外的命名空间前缀“app””。
我觉得这很奇怪,因为我在我的中使用了以下支持库build.gradle
:
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.1'
我使用这个文档作为我的指南。
我究竟做错了什么?
这是完整的布局:
<?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="250dp"
tools:context=".MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/tabRecyclerView"
android:layout_width="0dp"
android:layout_height="50dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toTopOf="@id/imageRecyclerView"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.RecyclerView
android:id="@+id/imageRecyclerView"
android:layout_width="0dp"
android:layout_height="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tabRecyclerView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="@color/lightshade"
/>
<TextView
android:id="@+id/add_favorites_message"
android:layout_width="0dp"
android:layout_height="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tabRecyclerView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:background="@color/lightshade"
android:text="@string/add_favorites_message"
android:visibility="gone"
android:gravity="center"
android:minLines="2"
android:maxLines="2" />
</android.support.constraint.ConstraintLayout>