com.android.support:design:28.0.0产生错误,因为错误膨胀了类TextInputLayout

时间:2019-06-15 07:13:39

标签: android android-textinputlayout android-textinputedittext

我的应用程序在测试中的所有设备上都能正常运行,其中从部署应用程序开始,某些大于SDK 26的用户将错误显示为

膨胀类TextInputLayout时出错

我的build.gradle文件是

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-crash:16.2.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-core-ui:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'

布局文件为

<com.rengwuxian.materialedittext.MaterialEditText
   android:id="@+id/edt_username"
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_margin="@dimen/dimen_8dp"
   android:drawableStart="@drawable/ic_boy"
   android:drawablePadding="@dimen/dimen_5dp"
   android:hint="@string/usernamehint"
   android:inputType="textNoSuggestions"
   android:textSize="@dimen/dimen_14sp"
   app:met_clearButton="true"
   app:met_floatingLabel="highlight"
   app:met_primaryColor="@color/colorPrimaryDark" />

<android.support.design.widget.TextInputLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_margin="@dimen/dimen_8dp"
   app:passwordToggleEnabled="true"
   app:passwordToggleTint="@color/grey">

  <android.support.design.widget.TextInputEditText
         android:id="@+id/edt_password"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:drawableStart="@drawable/ic_locked"
         android:drawablePadding="@dimen/dimen_5dp"
         android:gravity="center|start"
         android:hint="@string/password"                                    
         android:inputType="textPassword|textNoSuggestions"
         android:textSize="@dimen/dimen_14sp" />
</android.support.design.widget.TextInputLayout>

我无法找到问题,因为它在测试中工作正常。

请帮助我解决这个问题。

1 个答案:

答案 0 :(得分:0)

我建议切换到androidX。可能会解决您的问题

 implementation 'androidx.appcompat:appcompat:1.0.2'
 implementation 'androidx.legacy:legacy-support-v4:1.0.0'