Android 为什么materialButton关闭我的应用程序?
我是android开发的新手,但我遇到了一个错误,我模拟并生成了apk,在我使用api 26的设备中,一切正常,但在使用其他api的任何其他设备中,它以一种意外的方式关闭。。。编码、模拟和生成apk一部分一部分的代码我注意到android.support.design.button.MaterialButton会导致意外的关闭,如果我有一个在任何设备上工作的示例代码,我不理解为什么会出现这种错误 这里是我的gradle应用程序的图片和我应用materialButton的位置Android 为什么materialButton关闭我的应用程序?,android,material-design,material-ui,Android,Material Design,Material Ui,我是android开发的新手,但我遇到了一个错误,我模拟并生成了apk,在我使用api 26的设备中,一切正常,但在使用其他api的任何其他设备中,它以一种意外的方式关闭。。。编码、模拟和生成apk一部分一部分的代码我注意到android.support.design.button.MaterialButton会导致意外的关闭,如果我有一个在任何设备上工作的示例代码,我不理解为什么会出现这种错误 这里是我的gradle应用程序的图片和我应用materialButton的位置 <androi
<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" />
[
[
这是我的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" />
请帮帮我!!在
style.xml
文件中,将应用程序主题的基础更改为“材质设计库”中的基础。例如:
实际错误(文本中)可能会有帮助。更改应用程序主题可能会出现重复,请检查我的答案: