0% found this document useful (0 votes)
9 views3 pages

Practical 25

The document outlines the creation of an Android application that implements animation features, including fade, rotate, and zoom effects. It provides XML layout files for the user interface and animation definitions, as well as Java code for initializing and handling button click events to trigger these animations. The program includes buttons for starting the animations and an ImageView to display the animated content.
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)
9 views3 pages

Practical 25

The document outlines the creation of an Android application that implements animation features, including fade, rotate, and zoom effects. It provides XML layout files for the user interface and animation definitions, as well as Java code for initializing and handling button click events to trigger these animations. The program includes buttons for starting the animations and an ImageView to display the animated content.
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/ 3

Practical-25

Develop a Program for animation


activity_main.xml android:id="@+id/btnFade"
android:layout_width="match_paren
<?xml version="1.0" encoding="utf-
t"
8"?>
android:layout_height="wrap_conte
<LinearLayout
nt" android:text="Fade In/Out" />
xmlns:android="http://schemas.andr
</LinearLayout>
oid.com/apk/res/android"
android:layout_width="match_paren anim/rotate.xml
t"
<?xml version="1.0" encoding="utf-
android:layout_height="match_pare
8"?>
nt"
<rotate
android:orientation="vertical"
xmlns:android="http://schemas.andr
android:gravity="center"
oid.com/apk/res/android"
android:padding="20dp">
android:fromDegrees="0"
<ImageView
android:toDegrees="360"
android:id="@+id/imageView"
android:pivotX="50%"
android:layout_width="100dp"
android:pivotY="50%"
android:layout_height="100dp"
android:duration="1000"
android:src="@drawable/ic_launche
android:repeatCount="infinite"/>
r_foreground" />
<Button Zoom.xml
android:id="@+id/btnRotate" <?xml version="1.0" encoding="utf-
android:layout_width="match_paren 8"?>
t" <scale
android:layout_height="wrap_conte xmlns:android="http://schemas.andr
nt" oid.com/apk/res/android"
android:text="Clockwise/Anti android:fromXScale="1.0"
Clockwise" /> android:toXScale="1.5"
<Button android:fromYScale="1.0"
android:id="@+id/btnZoom" android:toYScale="1.5"
android:layout_width="match_paren android:pivotX="50%"
t" android:pivotY="50%"
android:layout_height="wrap_conte android:duration="1000"
nt" android:repeatMode="reverse"
android:text="Zoom In/Out" /> android:repeatCount="infinite"/>
<Button Fade.xml
<?xml version="1.0" encoding="utf- // Initialize UI components
8"?> imageView =
<alpha findViewById(R.id.imageView);
xmlns:android="http://schemas.andr btnRotate =
oid.com/apk/res/android" findViewById(R.id.btnRotate);
android:fromAlpha="1.0" btnZoom =
android:toAlpha="0.0" findViewById(R.id.btnZoom);
android:duration="1000" btnFade =
android:repeatMode="reverse" findViewById(R.id.btnFade);
android:repeatCount="infinite"/> // Load animations
rotateAnim =
MainActivity.java
AnimationUtils.loadAnimation(this,
package R.anim.rotate);
com.example.myapplication; zoomAnim =
import android.os.Bundle; AnimationUtils.loadAnimation(this,
import android.view.View; R.anim.zoom);
import fadeAnim =
android.view.animation.Animation; AnimationUtils.loadAnimation(this,
import R.anim.fade);
android.view.animation.AnimationU // Set click listeners to start
tils; animations
import android.widget.Button; btnRotate.setOnClickListener(v
import android.widget.ImageView; ->
import imageView.startAnimation(rotateAni
androidx.appcompat.app.AppCompa m));
tActivity; btnZoom.setOnClickListener(v
public class MainActivity extends ->
AppCompatActivity { imageView.startAnimation(zoomAni
ImageView imageView; m));
Button btnRotate, btnZoom, btnFade.setOnClickListener(v -
btnFade; >
Animation rotateAnim, imageView.startAnimation(fadeAni
zoomAnim, fadeAnim; m));
@Override }
protected void onCreate(Bundle }
savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_m
ain);
Clockwise/Anticlockwise

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy