布局预览渲染问题:不支持PorterDuff颜色过滤器。

10

在Android Studio 1.4中创建一个导航抽屉活动后,IDE会自动生成一些XML文件。
现在出现了一个问题:

布局编辑器中的图形预览可能不太准确: - 不支持PorterDuff Color Filters。

这是我的activity_navi.xml文件。

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_navi"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_navi"
        app:menu="@menu/activity_navi_drawer" />

</android.support.v4.widget.DrawerLayout>

我试图从activity_navi.xml中删除这些行,预览工作正常:

<include layout="@layout/app_bar_navi" android:layout_width="match_parent"
    android:layout_height="match_parent" />

<android.support.design.widget.NavigationView android:id="@+id/nav_view"
    android:layout_width="wrap_content" android:layout_height="match_parent"
    android:layout_gravity="start" android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_navi" app:menu="@menu/activity_navi_drawer" />

我刚刚发现,如果我将布局预览中的API级别更改为20或21,则问题会消失!而以前我选择的是API 19。

有人知道如何解决这个问题吗?

1个回答

1
我曾遇到相同的问题并解决了。 原因是您的SDK版本过低,或者Android版本过低。 更改SDK版本可以解决此问题,或者您可以更新SDK版本。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接