Slide show

Total Pageviews

Powered by Blogger.

Translate

Search This Blog

Pages

ANDROID ANIMATION DEMO

JAVA CODE  OF ANDROID ANIMATION:-


package com.AnimationDemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.TextView;

public class AnimationActivity extends Activity {
    TextView tv;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
        tv=(TextView)findViewById(R.id.tv);
        Animation a=AnimationUtils.loadAnimation(this,R.anim.myanimation);
       
        tv.startAnimation(a);
       
      //  tv.setVisibility(BIND_AUTO_CREATE);
    }
}


ANIMATION CODE IN ANIM FOLDER IN XML:-

  <?xml version="1.0" encoding="utf-8" ?>
- <set xmlns:android="http://schemas.android.com/apk/res/android">
  <alpha android:fromAlpha="0" android:toAlpha="1" android:duration="1000" android:startOffset="1000" />
  <scale android:fromXScale="1.0" android:toXScale="2.0" android:fromYScale="1.0" android:toYScale="2.0" android:pivotX="50%" android:pivotY="50%" android:startOffset="2000" android:duration="1000" />
  <translate android:fromXDelta="0" android:toXDelta="200" android:fromYDelta="0" android:toYDelta="0" android:duration="1000" android:startOffset="3000" />
  <rotate android:fromDegrees="0" android:toDegrees="180" android:pivotX="50%" android:pivotY="50%" android:duration="1000" android:startOffset="4000" android:repeatCount="1" android:repeatMode="reverse" />
  </set>
 
 
LAYOUT CODE IN XML:-
 
<?xml version="1.0" encoding="utf-8" ?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">
  <TextView android:id="@+id/tv" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:visibility="invisible" />
  </LinearLayout>
 
 
MANIFEST FILE CODE IN ANDROID:-
 
<?xml version="1.0" encoding="utf-8" ?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.AnimationDemo" android:versionCode="1" android:versionName="1.0">
  <uses-sdk android:minSdkVersion="3" />
- <application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
- <activity android:name=".AnimationActivity" android:label="@string/app_name">
- <intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
  </activity>
  </application>
  </manifest>
 
RUN and ENJOY THE ANIMATION TUTORIAL.
 
THANKS
 
 


No comments:

vehicles

business

health