AnimatedVectorDrawable支持< 21

时间:2016-09-27 18:35:37

标签: java android android-support-library android-vectordrawable

在我使用的项目中:

 compile 'com.android.support:appcompat-v7:24.2.0'
 compile 'com.android.support:design:24.2.0'
 compile 'com.android.support:support-vector-drawable:24.2.0'
 compile 'com.android.support:animated-vector-drawable:24.2.0'

在我的活动中我使用:

static {
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}

我有AnimatedVectorDrawable

  

vector_test_anim.xml

<animated-vector xmlns:tools="http://schemas.android.com/tools"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:drawable="@drawable/circle_black_simple"
  tools:ignore="NewApi">
  <target
      android:animation="@animator/blink"
      android:name="bl"/>

  </animated-vector>
  

circle_black_simple.xml

<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:viewportHeight="500.0"
android:viewportWidth="500.0"
android:width="24dp">
 <group
        android:name="blinkGroup">
        <path
            android:name="bl"
            android:fillColor="#696969"
            android:pathData="M250,250m-210,0a210,210 0,1 1,420 0a210,210 0,1 1,-420 0" />
    </group>
</vector>

我尝试用XML设置我的矢量动画,我有ResourceException 我尝试在我的适配器中设置我的矢量动画,然后检查isCompatVectorFromResourcesEnabled

 if(AppCompatDelegate.isCompatVectorFromResourcesEnabled()){
            Log.d(TAG,"isCompatVectorFromResourcesEnabled");
            mBinding.sendStatus.setImageResource(R.drawable.vector_test_anim);
        } else {
            Log.d(TAG,"NOT isCompatVectorFromResourcesEnabled");
        }

我尚未在视图中获得粘贴AnimatedVectorDrawable

请帮帮我,支持库我不能使用较低的版本?

0 个答案:

没有答案