animation_zoomin _and_zoomout




Step 0://res ma jai ne right click karvu pache new ma javu android resource file ma javanu and koi pn name aap devu and (for example animation name aapiyu)
and file name ni niche resouece type hse aema(animation pr click karvu)
//pche animation ma jai koi pn name aapi devu resoirce file ma jai ne(ex zoom in and zoomout)
Step 1:activity_main.xml
//aama ek imageView lai levu and
//zoom in and zoom out button lai leva jene click karvathe image zoom in and zoomout tse

Step 2:zoom_In
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>
</set>
Step 3:Zoom_Out
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>
Step 4:MainActivity.java

public class MainActivity extends AppCompatActivity {


    Button zoomin, zoomout, clockwise, fade;
    ImageView image;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        image = (ImageView) findViewById(R.id.iv);
        zoomin = findViewById(R.id.btn_zoomin);
        zoomout = findViewById(R.id.btn_zoomout);
        clockwise = findViewById(R.id.btn_cw);
        fade = findViewById(R.id.btn_fade);


        zoomin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.zoom_in);
                image.startAnimation(animation);
            }
        });

        zoomout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.zoom_out);
                image.startAnimation(animation);
            }
        });

        clockwise.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.clockwise);
                image.startAnimation(animation);
            }
        });

        fade.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade);
                image.startAnimation(animation);
            }
        });


    }
}

Comments

Popular posts from this blog

Seaborn

profile fragment firebase ie image and information vadu page update tay firebase ma

Payment ideal