2012-07-10 19 views
6

हाय मैं जानना चाहता हूं कि लोगो को एनिमेट करने और उसकी स्थिति को कैसे स्थानांतरित करना है?एंड्रॉइड छवि दृश्य स्केल एनीमेशन

मेरे पास एक ऐसा कथन है जो कुछ चेक चलाता है और फिर जब यह किया जाता है तो मैं इसे एक छवि दृश्य (लोगो) को स्केल करना चाहता हूं और उसे ऊपर ले जाना चाहता हूं।

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

आप ऐसा कर सकते हैं ScaleAnimation और TranslateAnimationAnimationSet

// 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

में एक साथ लागू करने के लिए सबसे अच्छा तरीका imageView रखने के लिए क्या द्वारा Vie में दिखाए गए पोस्ट एनीमेशन विशेषताओं के साथ दिखा रहा है डब्ल्यू? –

संबंधित मुद्दे