材质文本输入布局样式在实际设备上运行时不起作用 应用崩溃



我对材料组件样式有问题。 将以下样式添加到TextInputLayout中时,应用程序崩溃,但在android工作室预览中显示。

style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"

活动代码---

<com.google.android.material.textfield.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="ORDER`enter code here` NO"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/orderNo"
android:layout_width="173dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:background="@null"
android:imeOptions="actionNext"
android:inputType="number"
android:padding="10dp"

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

屬地-----

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0-alpha1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'com.vivekkaushik.datepicker:datePickerTimeline:0.0.3'

}

如果您的应用主题不是 Theme.MaterialComponents ,请尝试替换此依赖项

implementation 'com.google.android.material:material:1.1.0-alpha10'

有了这个

implementation 'com.google.android.material:material:1.0.0'

最新更新