Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android Studio渲染问题-缺少样式?_Java_Android_Xml_Android Studio - Fatal编程技术网

Java Android Studio渲染问题-缺少样式?

Java Android Studio渲染问题-缺少样式?,java,android,xml,android-studio,Java,Android,Xml,Android Studio,我在Android Studio的预览窗口中发现以下错误: 渲染问题缺少样式。选择的主题是否正确 这个布局?使用布局上方的“主题”组合框选择主题 不同的布局,或修复主题样式引用。找不到 当前主题中的“attr/actionBarPopupTheme”。(4)不存在类似错误 (如图所示) 我已经创建了自定义样式/主题。这是关于styles.xml的 <resources xmlns:tools="http://schemas.android.com/tools" xmlns:android=

我在Android Studio的预览窗口中发现以下错误:

渲染问题缺少样式。选择的主题是否正确 这个布局?使用布局上方的“主题”组合框选择主题 不同的布局,或修复主题样式引用。找不到 当前主题中的“attr/actionBarPopupTheme”。(4)不存在类似错误 (如图所示)

我已经创建了自定义样式/主题。这是关于
styles.xml的

<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light">
        <item name="android:actionBarStyle"   tools:ignore="NewApi">@style/MyActionBar</item>
        <item name="actionBarStyle">@style/MyActionBar</item>
        <item name="actionBarTheme">@style/MyActionBarTheme</item>
    </style>

    <style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background"  tools:ignore="NewApi">@color/white</item>
        <item name="titleTextStyle">@style/MyActionBar.ActionBar.TitleTextStyle</item>
        <item name="background">@color/bg_common</item>
    </style>

    <style name="MyActionBarTheme" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="actionMenuTextColor">@color/title</item>
        <item name="colorControlNormal">@color/title</item>
    </style>

    <style name="MyActionBar.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
        <item name="android:textColor">@color/title</item>
    </style>
</resources>

为什么我会出错?我还在预览窗口中选择了
CustomActionBarTheme
作为主题。我错过什么了吗?感谢您提前提出的建议

Android Studio使用安装的最新SDK预览布局文件。由于缺少样式,这可能会导致预览错误-切换到较旧的API级别(例如从23切换到22)可以解决此问题。

另一种方法是更改布局主题(靠近SDK预览版本按钮)
工作正常

尝试将SDK预览版本更改为旧版本Tanks!将API级别从23设置为22有帮助。您可以将此添加为我的问题的答案,我将其设置为确认答案:-)
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/CustomActionBarTheme"
    android:id="@+id/drawer_layout"
    android:background="@color/bg_common_2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

...
android:theme="@style/CustomActionBarTheme"