PowenKo, Android Tutorial 085-2, Animation,Animation_move

May 19, 2012   ·   0 Comments

Screen Shot 2012-05-19 at 4.42.52 PM

package com.powenko.Tutorial_UI_ImageView_slideshow;

import android.app.Activity;
import android.os.Bundle;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;

public class Tutorial_UI_ImageView_slideshowActivity extends Activity {
    /** Called when the activity is first created. */
	 @Override
	    public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.main);
	        ImageView image = (ImageView) findViewById(R.id.imageView1);
	        TranslateAnimation anim = new TranslateAnimation(-500, 50, 50, 50);
	        anim.setDuration(1000);
	        anim.setFillAfter(true);
	        image.startAnimation(anim);
	        image.setImageResource(R.drawable.powenko);
	    }
}
<?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" >


    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />

</LinearLayout>
shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Android7

Amazon

adsbygoogle

Recent Posts

Categories

Amazon