问题描述:
在Android studio中对应activity的xml的preview中,不能正常显示布局的设计,提示错误
The following classes could not be instantiated:
- android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.app.WindowDecorActionBar (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.
If this is an unexpected error you can also try to build the project, then manually refresh the layout.
修改方法:
在style资源文件中,将
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
修改成:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
</style>
然后测试可以显示对应的布局!