使用 CoordinatorLayout 出错 inflating class android.support.design.widget.CoordinatorLayout

时间:2024-12-13 14:04:26

ava.lang.RuntimeException: Unable to start activity ComponentInfo{com.czr.ianpu/com.czr.ianpu.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.design.widget.CoordinatorLayout
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2667)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2737)
at android.app.ActivityThread.access$800(ActivityThread.java:186)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1574)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:192)
at android.app.ActivityThread.main(ActivityThread.java:5865)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1021)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:816)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class android.support.design.widget.CoordinatorLayout

  


需要在清单文件中设置 

android:theme="@style/Theme.AppCompat"