2015-11-11 20 views
10

Sau khi tôi tạo Hoạt động ngăn điều hướng trong Android Studio 1.4, IDE tự động tạo một số tệp xml.
Bây giờ có một vấn đề:Bố cục xem trước vấn đề hiển thị: Bộ lọc màu PorterDuff không được hỗ trợ

Các preview đồ họa trong trình soạn thảo bố cục có thể không chính xác: - Bộ lọc PorterDuff Màu không được hỗ trợ.

Đây là activity_navi.xml tôi

<?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> 

tôi đã cố gắng để loại bỏ những dòng này từ activity_navi.xml và xem trước hoạt động tốt:

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

Tôi chỉ tìm thấy nếu tôi thay đổi cấp độ API để 20 hoặc 21 trong Layout Preview, vấn đề biến mất! Và trước khi tôi chọn API 19.

Có ai biết cách giải quyết vấn đề này không?

Trả lời

1

Tôi đã gặp sự cố tương tự và được giải quyết. Đó là do phiên bản SDK của bạn quá thấp hoặc phiên bản Android quá thấp. Bằng cách thay đổi phiên bản SDK của bạn sẽ giải quyết vấn đề này hoặc bạn có thể cập nhật phiên bản SDK của mình.

Các vấn đề liên quan