애니메이션 벡터 드로어 블 here을 사용하려면 Android 가이드 라인을 따르십시오. 나는 (img_logo.xml)AnimatedVectorDrawable에 애니메이션이 표시되지 않습니다. API 21+
애니메이션 벡터 당김 XML 파일
<animated-vector xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/ic_logo" >
<target
android:name="rotationGroup"
android:animation="@anim/rotate" />
<target
android:name="v"
android:animation="@anim/anim_path" />
</animated-vector>
및 이미지 뷰
<ImageView
android:id="@+id/img_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="@dimen/view_elevation"
android:layout_marginBottom="@dimen/activity_horizontal_margin"/>
로 설정 안드로이드 벡터 스튜디오
를 사용하여 XML 벡터 파일을 만들었습니다 또한 아래 코드를 사용하여 코드에서 애니메이션을 시도했습니다 here
AnimatedVectorDrawable d = (AnimatedVectorDrawable) getDrawable(R.drawable.anim_logo); // Insert your AnimatedVectorDrawable resource identifier
mImageView.setImageDrawable(d);
d.start();
Belom 애니메이션 XML anim_path.xml 있습니다
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:duration="1000"
android:propertyName="pathData"
android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z"
android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z"
android:valueType="pathType" />
</set>
rotate.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<objectAnimator
android:duration="1000"
android:propertyName="rotation"
android:valueFrom="0"
android:valueTo="360" />
</set>
당신이 here 01,235,164에서 벡터 당김을 찾을 수 있습니다 가이드에 언급 된대로 모든 것을 설정했지만 앱을 실행하면 이미지에 애니메이션이 적용되지 않습니다. 어떤 도움을 주셔서 감사합니다.
충분한 정보가 여기에 있다고 생각하지 마십시오. VectorDrawable 및 Animators의 xml은 무엇입니까? 화면에서 무엇을 볼 수 있습니까? 오류 메시지가 있습니까? –
@LewisMcGeary 업데이트 된 질문을 확인하십시오. –