使用具有约束布局的设计支持库

Max*_*uta 3 android textinputlayout android-constraintlayout

我尝试在 ConstraintLayout 中使用支持设计库中的 TextInputLayout,但出现错误:

android.widget.LinearLayout$LayoutParams 
cannot be cast to android.support.constraint.ConstraintLayout$LayoutParams
Run Code Online (Sandbox Code Playgroud)

如何实现与 support.design.widget.TextInputLayout 相同的功能,但使用 ConstraintLayout?

完整布局在这里:http : //pastebin.com/TjC0FAdS

问题是:

<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="match_parent"
    android:id="@+id/constraintLayout">

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <AutoCompleteTextView
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:singleLine="true"
            android:id="@+id/email"
            android:hint="@string/prompt_email"
            app:layout_constraintLeft_toRightOf="@+id/imageView3"
            android:layout_marginStart="8dp"
            app:layout_constraintTop_toBottomOf="@+id/logo"
            android:layout_marginTop="16dp"
            app:layout_constraintRight_toRightOf="@+id/constraintLayout"
            android:layout_marginEnd="16dp" />
    </android.support.design.widget.TextInputLayout>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

Gen*_*kin 5

诸如app:layout_constraintLeft_toRightOf需要ConstraintLayout是父视图之类的属性。将这些属性移动到TextInputLayout,它应该可以正常工作。