在真实设备应用崩溃时运行的实质性TextInputLayout样式无法正常工作

时间:2019-10-04 10:31:49

标签: android xml material-components-android

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

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'



}

1 个答案:

答案 0 :(得分:0)

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

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

与此

implementation 'com.google.android.material:material:1.0.0'
相关问题