我是Android语言的新手,但我熟悉其他编程语言。今天当我想从here开始构建我的第一个应用程序时,当我使用Android Studio创建项目时,我收到此错误按摩:
Rendering Problems The following classes could not be instantiated:
- android.support.design.widget.CoordinatorLayout (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.AppBarLayout (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE Exception Details java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:34)
at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:184)
at android.support.design.widget.CoordinatorLayout.<init>(CoordinatorLayout.java:178)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.android.layoutlib.bridge.android.BridgeInflater.loadCustomView(BridgeInflater.java:205)
at com.android.layoutlib.bridge.android.BridgeInflater.createViewFromTag(BridgeInflater.java:133)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385) at android.view.LayoutInflater.inflate(LayoutInflater.java:296) Copy stack to clipboard
我尝试了其他堆栈问题中的一些解决方案,但问题没有解决。我该怎么办?
答案 0 :(得分:1)
看起来答案就在你的堆栈跟踪中:
You need to use a Theme.AppCompat theme (or descendant) with the design library.
请尝试按照此处的说明操作:
You need to use a Theme.AppCompat theme (or descendant) with this activity