您的位置:首页 > 移动开发 > Android开发

Android Studio 新建项目无法查看布局文件的问题

2015-05-18 22:32 459 查看
Android Studio 新建项目出现的问题,最新版的AndroidStudio新建项目后可能在layout布局文件中预览不了我们写的布局报下面错误

Rendering Problems The following classes could not be instantiated:
- android.support.v7.internal.widget.ActionBarOverlayLayout (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.ClassNotFoundException: android.support.v7.appcompat.R$attr Copy stack to clipboard




百度搜搜索的时候很少有类似的错误,大多说在File/Project Str8cture/app/Dependencies里面添加v7包,实际默认已经添加了。解决起来很容易最简单的方法就是修改主题,如下所示

解决方案

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>
</resources>
<!-------------华丽的分割线------------------>
<!--将Theme修改成为-->
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

</resources>


OK大功告成,再去看看,可以了吧。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐