2013-03-26 3 views

답변

0

이 같은 시도 할 수 있습니다 :

Grow_from_middle.xml

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android" > 

    <scale 
     android:duration="200" 
     android:fillAfter="false" 
     android:fromXScale="0.0" 
     android:fromYScale="0.7" 
     android:interpolator="@android:anim/linear_interpolator" 
     android:startOffset="200" 
     android:toXScale="1.0" 
     android:toYScale="1.0" /> 

    <translate 
     android:duration="200" 
     android:fromXDelta="50%" 
     android:startOffset="200" 
     android:toXDelta="0" /> 

</set> 

shrink_to_middle.xml

<?xml version="1.0" encoding="utf-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android" > 

    <scale 
     android:duration="200" 
     android:fillAfter="false" 
     android:fromXScale="1.0" 
     android:fromYScale="1.0" 
     android:interpolator="@android:anim/linear_interpolator" 
     android:toXScale="0.0" 
     android:toYScale="0.7" /> 

    <translate 
     android:duration="200" 
     android:fromXDelta="0" 
     android:toXDelta="50%" /> 

</set> 

사용이 같은 :

overridePendingTransition(R.anim.grow_from_middle,R.anim.shrink_to_middle); 

희망이 도움이 될 것입니다.

1
private void applyRotation(float start, float end) { 
// Find the center of image 
final float centerX = image1.getWidth()/2.0f; 
final float centerY = image1.getHeight()/2.0f; 

// Create a new 3D rotation with the supplied parameter 
// The animation listener is used to trigger the next animation 
final Flip3dAnimation rotation = 
     new Flip3dAnimation(start, end, centerX, centerY); 
rotation.setDuration(500); 
rotation.setFillAfter(true); 
rotation.setInterpolator(new AccelerateInterpolator()); 
rotation.setAnimationListener(new DisplayNextView(isFirstImage, image1, image2)); 

if (isFirstImage) 
{ 
image1.startAnimation(rotation); // "YourLayout" 
} else { 
image2.startAnimation(rotation); // "Your Other Layout" 
} 

} 

이 튜토리얼은 사용자가 요구하는 것과 정확히 일치한다. http://www.inter-fuser.com/2009/08/android-animations-3d-flip.html

관련 문제