[英]why crash my app when use the Material button?
我想使用 materail 按鈕,但是當我編寫並運行程序時,程序崩潰了。 我需要什么幫助?
這是我的代碼
<com.google.android.material.button.MaterialButton
style="@style/TextAppearance.MaterialComponents.Button"
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"/>
這個 build.gradle
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' implementation 'com.squareup.okhttp3:okhttp:4.2.2' implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.squareup.okhttp:okhttp:2.7.5' implementation 'de.hdodenhof:circleimageview:3.0.1' implementation 'com.wang.avi:library:2.1.3' implementation 'com.github.pwittchen:swipe-rx2:0.3.0' implementation 'com.ogaclejapan.smarttablayout:library:2.0.0@aar' implementation 'com.ogaclejapan.smarttablayout:utils-v4:2.0.0@aar' implementation 'com.mcxiaoke.volley:library:1.0.19' compile 'com.github.bumptech.glide:glide:3.8.0' implementation 'org.greenrobot:eventbus:3.1.1'
要使 MaterialButton 工作,App 主題必須從 Theme.MaterialComponents(或后代)繼承
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.