VectorDrawableCompat使用置换绘制图标

时间:2016-04-28 19:51:06

标签: android android-vectordrawable

请解释一下如何修复它?我加载矢量drawable调用VectorDrawableCompat.create(context.getResources(), resId, context.getTheme());
它适用于所有受支持的设备(从API 8开始),但绘制带位移的所有图标。为什么?我不明白。例如,它的NavigationView菜单:
Screenshot
布局边界:
Screenshot when boundary showing enabled
build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 23
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {

        release {
            minifyEnabled true
            zipAlignEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    'proguard-rules.pro'
        }
    }

    aaptOptions {
        additionalParameters "--no-version-vectors"
    }
}

dependencies {
    compile 'com.android.support:design:23.3.0'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile 'com.android.support:support-v4:23.3.0'
}


VectorDrawable

的示例
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M19,3h-1L18,1h-2v2L8,3L8,1L6,1v2L5,3c-1.11,0 -1.99,0.9 -1.99,2L3,19c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19L5,19L5,8h14v11zM7,10h5v5L7,15z"/>
</vector>


P.S.我在Android 6.0模拟器上用软件渲染(Ubuntu 16.04和radeon HD 5xxx,Imma幸运)制作了这个截图。不幸的是,我还没有真正的设备......可能是因为软件渲染了吗?

0 个答案:

没有答案