渲染问题:Android Studio 1.2.1.1和Gradle 1.2.3

时间:2015-05-19 14:18:06

标签: android android-layout android-studio rendering

我使用gradle 1.2.3更新了android studio到最新版本“1.2.1.1”。但是我的项目和新项目有问题.. 由于此问题,所有布局文件都无法显示预览:

Rendering problems

The following classes could not be found: android.support.v7.internal.widget.ActionBarOverlayLayout

我找到了解决方案,将主题更改为:

Base.Theme.Appcompat

但现在它不显示任何自定义视图甚至Appcompat视图。它给了我这个错误:

The following classes could not be found: - android.support.v7.widget.Toolbar (Fix Build Path, Create Class)
The following classes could not be found: - CustomView.VoiceView (Fix Build Path, Create Class)
 Tip: Try to build the project.

我还尝试将渲染版本更改为21而不是22 .. 它不起作用。清洁和重建不做任何事情.. 提前谢谢。

更新[添加style.xml]: 我的样式代码是:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="@style/Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/light_blue_500</item>
        <item name="colorPrimaryDark">@color/light_blue_700</item>
        <item name="colorAccent">@color/light_ornage_500</item>
    </style>



    <style name="RevealOrange" parent="@style/Base.Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/light_blue_500</item>
        <item name="colorPrimaryDark">@color/light_ornage_700</item>
        <item name="colorAccent">@color/light_ornage_500</item>
    </style>

</resources>

2 个答案:

答案 0 :(得分:-1)

这个主题适合我试试这个

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/my_awesome_color</item>
        <item name="colorPrimaryDark">@color/my_awesome_darker_color</item>
        <item name="colorAccent">@color/accent</item>
    </style>

答案 1 :(得分:-1)

Android Studio构建一个目标等于或大于21且minSdk非常低的项目可能是个问题,就像10.创建一个值-v21 / styles就像下面一样。

<style name="AppTheme" parent="android:Theme.Material">
    <item name="colorPrimary">@color/my_awesome_color</item>
    <item name="colorPrimaryDark">@color/my_awesome_darker_color</item>
    <item name="colorAccent">@color/accent</item>
</style>