0% found this document useful (0 votes)
29 views2 pages

Practical 25

The document describes an Android application with an image view and buttons to perform different animations on the image like fade in, fade out, zoom in, zoom out, rotate clockwise and anticlockwise. The XML layout contains the user interface elements and Java code handles the button click listeners and loads the relevant animations.

Uploaded by

Ritesh Kolate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Practical 25

The document describes an Android application with an image view and buttons to perform different animations on the image like fade in, fade out, zoom in, zoom out, rotate clockwise and anticlockwise. The XML layout contains the user interface elements and Java code handles the button click listeners and loads the relevant animations.

Uploaded by

Ritesh Kolate
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Practical 25

activity_main.xml android:layout_height="wrap_content"
<?xml version="1.0" encoding="utf-8"?> android:layout_x="56dp"
<AbsoluteLayout android:layout_y="388dp"
xmlns:android="http://schemas.android.com/apk/ android:text="Zoom Out" />
res/android"
xmlns:app="http://schemas.android.com/apk/ <Button
res-auto" android:id="@+id/btn5"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="match_parent" android:layout_x="193dp"
tools:context=".MainActivity"> android:layout_y="388dp"
android:text="Clock Wise" />
<ImageView
android:id="@+id/imageView" <Button
android:layout_width="317dp" android:id="@+id/button6"
android:layout_height="250dp" android:layout_width="wrap_content"
android:layout_x="28dp" android:layout_height="wrap_content"
android:layout_y="31dp" android:layout_x="108dp"
app:srcCompat="@drawable/pokemon" /> android:layout_y="450dp"
<Button android:text="Anti ClockWise" />
android:id="@+id/btn1" </AbsoluteLayout>
android:layout_width="wrap_content"
android:layout_height="wrap_content" MainActvity.java
android:layout_x="23dp" package com.example.practical25;
android:layout_y="329dp" import
android:text="Fade In" /> androidx.appcompat.app.AppCompatActivity;
<Button import android.os.Bundle;
android:id="@+id/btn2" import android.view.View;
android:layout_width="wrap_content" import android.view.animation.Animation;
android:layout_height="wrap_content" import android.view.animation.AnimationUtils;
android:layout_x="131dp" import android.widget.Button;
android:layout_y="328dp" import android.widget.ImageView;
android:text="Fade Out" /> public class MainActivity extends
AppCompatActivity {
<Button Button b1,b2,b3,b4,b5,b6;
android:id="@+id/btn3" ImageView i1;
android:layout_width="wrap_content" Animation animation;
android:layout_height="wrap_content"
android:layout_x="247dp" @Override
android:layout_y="325dp" protected void onCreate(Bundle savedInstanceState)
android:text="Zoom In" /> {
super.onCreate(savedInstanceState);
<Button setContentView(R.layout.activity_main);
android:id="@+id/btn4" i1=(ImageView) findViewById(R.id.imageView);
android:layout_width="wrap_content" b1=(Button) findViewById(R.id.btn1);
b2=(Button) findViewById(R.id.btn2);
b3=(Button) findViewById(R.id.btn3);
b4=(Button) findViewById(R.id.btn4);
b5=(Button) findViewById(R.id.btn5);
b1.setOnClickListener(new View.OnClickListener() { fadein.xml
@Override
public void onClick(View v) { <?xml version="1.0" encoding="utf-8"?>
<set
animation=AnimationUtils.loadAnimation(MainActivity xmlns:android="http://schemas.android.com/apk/
.this,R.anim.fadein); res/android"
i1.startAnimation(animation); android:fillAfter="true">
} <alpha
}); android:duration="3000"
android:fromAlpha="0.0"
b2.setOnClickListener(new android:toAlpha="1.1"
View.OnClickListener() { />
@Override </set>
public void onClick(View v) {
animation = fadeout.xml
AnimationUtils.loadAnimation(MainActivity.this, <?xml version="1.0" encoding="utf-8"?>
R.anim.fadeout1); <set xmlns:android="http://schemas.android.com/
i1.startAnimation(animation); apk/res/android"
} android:fillAfter="true">
}); <alpha
} android:duration="3000"
} android:fromAlpha="1.0"
android:toAlpha="0.0"
/>
</set>

Output:

You might also like