2012-07-10 10 views
6

안녕하세요, 저는 어떻게 로고를 애니메이션화하고 그 위치를 움직이는 지 알고 싶습니까?android image view scale animation

나는 몇 가지 검사를 실행하는 if 문을 가지고 있으며, 완료되면 이미지보기 (로고)를 축소하여 위로 이동하려고합니다.

을 heres 내 레이아웃

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:background="@drawable/bg_default" > 

    <ImageView 
     android:id="@+id/su_logo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="34dp" 
     android:src="@drawable/su_logo" 
     android:contentDescription="@string/cd_su_logo"/> 

    <ImageView 
     android:id="@+id/su_shirts" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:src="@drawable/su_shirts" 
     android:contentDescription="@string/cd_su_shirts" /> 

</RelativeLayout> 

을 heres 내 자바

public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.layout_initialsetup); 
     preChecks(); 
    } 

public void preChecks(){ 
    //check for internet connection 

    //check version 
    String curVersion = getResources().getString(R.string.app_versionCode); 
    int curVer = Integer.parseInt(curVersion); 
    String LiveVersion = "100"; 
    int liveVer = Integer.parseInt(LiveVersion); 

    if(curVer < liveVer) Log.v("setup", "There is a new version"); 
    else { 

     //scale animation 


    } 




} 

답변

18

당신이 할 수있는 이미지 뷰를 유지하는 가장 좋은 방법은 무엇 AnimationSet

// Scaling 
Animation scale = new ScaleAnimation(fromXscale, toXscale, fromYscale, toYscale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 
// 1 second duration 
scale.setDuration(1000); 
// Moving up 
Animation slideUp = new TranslateAnimation(fromX, toX, fromY, toY); 
// 1 second duration 
slideUp.setDuration(1000); 
// Animation set to join both scaling and moving 
AnimationSet animSet = new AnimationSet(true); 
animSet.setFillEnabled(true); 
animSet.addAnimation(scale); 
animSet.addAnimation(slideUp); 
// Launching animation set 
logo.startAnimation(animSet); 
+0

함께 ScaleAnimationTranslateAnimation을 적용하여 그것은 Vie에 보여지는 포스트 애니메이션 속성으로 보여줍니다. w? –