animation in android?

后端 未结 2 629
生来不讨喜
生来不讨喜 2021-01-25 08:29

I am new to android.I need to know the Basic Animation in Android for View\'s and View Group\'s.Can anyone give some Guide lines to learn it !!! Thanks in advance...

相关标签:
2条回答
  • 2021-01-25 08:45

    for future visitors i guess you need to try this nineoldandroids android animation

    its so simple to use. dont forget to read the docs.

    download the zip, use the src copy to your main folder src folder, or you can make a jar file out of it, or make it a library .. as for me I copied the src to my src.

    package com.example.titleanimation;
    
    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    import android.widget.ImageView;
    
    import static com.nineoldandroids.view.ViewPropertyAnimator.animate;
    
    public class MainActivity extends Activity {
    
    
    private ImageView image;
    
    
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        image = (ImageView) findViewById(R.id.imageView1);
    
                /*
                   to do it like this you need to add import  
                   import static com.nineoldandroids.view.ViewPropertyAnimator.animate;
                */
        animate(image).setDuration(10000).rotationBy(360);
    
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
    }
    

    happy coding ^^ NOTE : i tried Tween Engine by Aurielien Ribbon but theres a problem with API 8 , views dont have setX and setY.

    best regards, Dave

    0 讨论(0)
  • 2021-01-25 08:50

    You could start by reading the official guide to animations

    0 讨论(0)
提交回复
热议问题