Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Layout Preview Rendering Problems: PorterDuff Color Filters are not supported

Tags:

java

android

After I created a Navigation Drawer Activity in Android Studio 1.4, the IDE automatically generated some xml files.
Now there's a problem:

The graphics preview in the layout editor may not be accurate: - PorterDuff Color Filters are not supported.

Here is my 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>

I tried to remove these lines from activity_navi.xml and the preview works fine:

<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" />

I just found if I change API level to 20 or 21 in Layout Preview, the problem disappear! And before I picked API 19.

Does anyone know how to solve this issue?

like image 877
Inso Avatar asked Nov 11 '15 14:11

Inso


1 Answers

I've ran into the same problem and solved. It's because your SDK version is too low, or Android version is too low. By changing your SDK version would solve this problem, or you can update your SDK version.

like image 58
Jade Avatar answered Sep 28 '22 17:09

Jade