eclipse新建Android项目无法显示xml布局文件

时间:2023-01-22 08:32:54

今天使用eclipse新建Android项目后,编写xml布局文件时想预览一下效果,
结果无法显示,并且报错:The following classes could not be instantiated:
- android.support.v7.internal.app.WindowDecorActionBar `
经过一方折腾和查阅资料,记录一下解决此问题的方法:
方法1.在项目res的value或者values-XX目录下的styles.xml,找到属性:
parent=”Theme.AppCompat.Light.DarkActionBar,
将其修改为:parent=”Base.Theme.AppCompat.Light.DarkActionBar”,
即在原来的parent属性中添加了”Base.”前缀.

方法2.更改api版本:在xml布局预览界面,将api版本更改为低版本。(一般不建议这样做)
如图:
eclipse新建Android项目无法显示xml布局文件

方法3.跟方法1类似 ,只是把parent的值改成其他的,
如改成:parent=”Theme.AppCompat.Light.NoActionBar”