Tampilkan postingan dengan label transition. Tampilkan semua postingan
Tampilkan postingan dengan label transition. Tampilkan semua postingan

Falling Animation in ANDROID using Animation of Translate

Posted by Unknown Sabtu, 20 April 2013 0 komentar
Falling animation is used to bring transition to a view between two X points or two Y points. In Android, you can apply this scaling effect to almost anything, from simple text, to images, buttons, etc…

in res/anim/falling.xml
suppose if transition to be done between two different X indexes use..
 
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromXDelta="-100%p"
android:toXDelta="0"
android:duration="2000"/>
</set>

suppose if transition to be done between two different Y indexes use..
 
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromYDelta="-100%p"
android:toYDelta="0"
android:duration="2000"/>
</set> 
The java source code is given below
 
public class Textviewanimation extends Activity {
TextView tv;
Button startanimation;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_textviewanimation);

tv=(TextView) findViewById(R.id.textview);
startanimation=(Button) findViewById(R.id.button1);
tv.setText("Android is a Linux-based operating system designed primarily for touchscreen mobile devices such as smartphones and tablet computers.");

final Animation falling = AnimationUtils.loadAnimation(this,R.anim.falling);
startanimation.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
tv.startAnimation(falling);
}
}); }
}
see more :

Baca Selengkapnya ....

View Flipper with Animationin ANDROID

Posted by Unknown Selasa, 19 Maret 2013 0 komentar
Suppose you have to show an item for few minutes and then flips to next one we can use viewflipper. ViewFlipper inherits from frame layout, so it displays a single view at a time. in java class:
   ViewFlipper vflip;
vflip=(ViewFlipper) findViewById(R.id.viewFlipper1);
//when a view is displayed
vflip.setInAnimation(this,android.R.anim.fade_in);
//when a view disappears
vflip.setOutAnimation(this, android.R.anim.fade_out);
vflip.setFlipInterval(500);
vflip.startFlipping();//starts flippin
// vflip.stopFlipping();//stops flipping
in xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ViewFlipper
android:id="@+id/viewFlipper1"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_marginRight="16dp"
android:layout_marginTop="85dp"
android:layout_toLeftOf="@+id/textView1" >

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

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

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

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

</ViewFlipper>
</RelativeLayout>
Here the view changes for every 500 millisecond.same way we can even provide layouts inside it.

Baca Selengkapnya ....
Trik SEO Terbaru support Online Shop Baju Wanita - Original design by Bamz | Copyright of android populer.