【问题标题】:Rendering Problems: Android Studio 1.2.1.1 and Gradle 1.2.3渲染问题:Android Studio 1.2.1.1 和 Gradle 1.2.3
【发布时间】:2015-07-31 10:29:50
【问题描述】:

我用 gradle 1.2.3 将 android studio 更新到最新版本“1.2.1.1”..但是我的项目和新项目有问题.. 由于这个问题,所有 Layouts 文件都无法显示预览:

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>

【问题讨论】:

  • 显示你的styles.xml
  • @Nilesh 更新 style.xml 代码..请检查。
  • 尝试使用 noActionbar 主题
  • 删除了“Base”并没有添加“NoActionBar”但同样的问题..
  • 我已发布答案,请检查并恢复

标签: android android-layout android-studio rendering


【解决方案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>

【讨论】:

  • 嗯。它不起作用:( ...你有哪个版本的android studio和gradle??
【解决方案2】:

可能是 Android Studio 构建目标等于或大于 21 且 minSdk 非常低(如 10)的项目的问题。创建如下所示的 values-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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-10
    • 2015-08-21
    相关资源
    最近更新 更多