为什么materialButton关闭我的应用程序



我是android开发的新手,但我在模拟和生成apk时遇到了一个错误,在我的带有api 26的设备中一切都很好,但在任何其他带有另一个api的设备中,它以一种意想不到的方式关闭。。。编码、模拟和逐部分生成apk我注意到android.support.design.button.MaterialButton导致了意外的关闭,如果我有一个适用于任何设备的示例代码,我不明白为什么会出现这个错误。

这里是我的gradle应用程序的图像,以及我在哪里应用materialButton

[https://i.stack.imgur.com/dNo5L.png][1]

[https://i.stack.imgur.com/FUEq0.png][2]

这是我的gradle应用

apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.ts.ts.ts"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
api 'com.android.support:design:28.0.0'

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 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'com.journeyapps:zxing-android-embedded:2.0.1@aar'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'com.google.android.gms:play-services-plus:16.0.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'}

这就是我应用materialButton 的xml

<android.support.design.button.MaterialButton
android:id="@+id/cancel_button"
style="@style/Widget.Shrine.Button.textButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_toStartOf="@id/next_button"
android:layout_toLeftOf="@id/next_button"
android:text="@string/shr_button_cancel" />

请帮帮我!!!!

styles.xml文件中,将应用程序主题的基础更改为材料设计库中的基础。例如:

<style name="AppTheme" parent="Theme.MaterialComponents.Light">

最新更新