2012-03-13 6 views
0

이것은 xml의 애니메이션입니다. android : pivotX = "50 %"로 시도했지만 여전히 원하는 것을 얻지 못했습니다. 회전 지점이 잘못되었습니다. 녹색 선을 화면 중간에서 회전 시키길 원합니다.xml의 회전 애니메이션이 중간에서 회전하지 않습니다

<?xml version="1.0" encoding="utf-8"?> 
<rotate xmlns:android="http://schemas.android.com/apk/res/android" 
    android:fromDegrees="0" android:interpolator="@android:anim/linear_interpolator" 
    android:toDegrees="360" android:pivotX="0%" android:pivotY="0%" 
    android:repeatCount="5" 
    android:duration="5000" android:startOffset="0" /> 

나는이 같은 애니메이션을 만들고 싶어 : enter image description here 녹색 선은 회전해야하며, 회전 포인트는 화면의 중앙에 있어야한다. 어떻게해야합니까?

+0

그것은 현재의 증상이 무엇인지 불분명하지만,이 문제와 관련 될 수 있습니다 http://code.google.com/p/android/issues/detail?id=22969 – CommonsWare

+2

@Lukap은 안 'android : pivotX'와'android : pivotY'가''50 %''로 설정되어 있습니다. – Selvin

답변

-2

피벗 점을 이미지의 가운데로 설정하여 회전 애니메이션을 사용합니다.

RotateAnimation anim = new RotateAnimation(0f, 350f, 15f, 15f); 
anim.setInterpolator(new LinearInterpolator()); 
anim.setRepeatCount(Animation.INFINITE); 
anim.setDuration(700); 

// Start animating the image 
final ImageView splash = (ImageView) findViewById(R.id.splash); 
splash.startAnimation(anim); 

// Later.. stop the animation 
splash.setAnimation(null); 
관련 문제