android studio preview 出现 Rendering Problems的解决方法

来源:互联网 发布:js clear 编辑:程序博客网 时间:2024/06/08 08:18

最近使用android studio打开xml文件,总是不能正常显示preview界面,就找到了以下解决方案。

本文转自http://blog.csdn.net/luckymxq/article/details/50476595,在这里感谢原博主的分享。

1.  打开 res/values/styles.xml  内容如下

<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimary">@color/colorPrimary</item>        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>        <item name="colorAccent">@color/colorAccent</item>    </style></resources>
2. 在 parent="Theme.AppCompat.Light.DarkActionBar" 之句话中的 Theme 前面 添加 Base
修改后的代码为:
<resources>    <!-- Base application theme. -->    <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimary">@color/colorPrimary</item>        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>        <item name="colorAccent">@color/colorAccent</item>    </style></resources>

0 0