passwordToggleEnabled com.google.android.material.textfield.TextInputLayout崩溃

时间:2019-03-09 02:29:52

标签: android

将app:passwordToggleEnabled =“ true”用于

导致应用崩溃
  <com.google.android.material.textfield.TextInputLayout ...>

适用于

  <android.support.design.widget.TextInputLayout ..>

可能是什么原因? 这是我的XML .....................................................

     <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/input_layout_password"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            app:boxStrokeColor="@color/border"
            app:boxStrokeWidth="@dimen/margin_2dp"
            android:hint="@string/hint_password"
            app:errorTextAppearance="@style/error_appearance"
            app:passwordToggleEnabled="true"
            style="@style/TextLabelMaterial"

            >

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/edt_password"
                android:background="@drawable/bg_edittext"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                android:imeOptions="actionNext"
                android:inputType="textPassword" />

        </com.google.android.material.textfield.TextInputLayout>

崩溃日志:

android.view.InflateException: Binary XML file line #39: android.support.design.widget.CheckableImageButton cannot be cast to com.google.android.material.internal.CheckableImageButton
Caused by: java.lang.ClassCastException: android.support.design.widget.CheckableImageButton cannot be cast to com.google.android.material.internal.CheckableImageButton
    at com.google.android.material.textfield.TextInputLayout.updatePasswordToggleView(TextInputLayout.java:1600)
    at com.google.android.material.textfield.TextInputLayout.setEditText(TextInputLayout.java:733)
    at com.google.android.material.textfield.TextInputLayout.addView(TextInputLayout.java:388)

0 个答案:

没有答案