问题描述
在TextInputLayout中使用样式时,出现以下错误。我该如何解决?
引起者:java.lang.IllegalArgumentException:此样式 组件要求您的应用主题为Theme.MaterialComponents(或 后裔)。
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:boxStrokeColor="#ffcc00"
android:theme="@style/EditTextTheme"
app:layout_constraintEnd_toStartOf="@id/guidelineEnd"
app:layout_constraintStart_toStartOf="@id/guidelineStart"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1" />
</com.google.android.material.textfield.TextInputLayout>
应用此功能可解决此问题,但在TextInputLayout中未实现轮廓边框
styles.xml
<style name="EditTextTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)