我在Android Studio 1.4中创建了一个Navigation Drawer Activity后,IDE自动生成了一些xml文件。
现在有一个问题:
布局编辑器中的图形预览可能不准确: - 不支持 PorterDuff 滤色器。
这是我的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 之前。
有谁知道如何解决这个问题?
最佳答案
我遇到了同样的问题并解决了。 是你的SDK版本太低,或者Android版本太低。 通过更改您的 SDK 版本可以解决此问题,或者您可以更新您的 SDK 版本。
关于java - 布局预览渲染问题 : PorterDuff Color Filters are not supported,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33653012/