.:: Jasa Membuat Aplikasi Website,Desktop,Android Order Now..!! | | Order Now..!! Jasa Membuat Project Arduino,Robotic,Print 3D ::.

Android ViewFlipper Animation example

0 komentar


بِسْــــــــــــــــمِ اﷲِالرَّحْمَنِ اارَّحِيم
bismillaahirrahmaanirrahiim

السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
Assalamu'alaikum warahmatullahi wabarakatuh

ViewFlipper is a subclass of ViewAnimator that makes it easy to animate a bunch of views that are added to it. It only displays one child view at a time and you can also set it to rotate the views automatically. Just keep in mind that if you have duration set for your animation alpha then the flipper duration should be greater than that otherwise the view will change even before it completely comes into focus.

String Resource - strings.xml



ViewFlipper
Settings

#ffe4c4
#cdc9c9
#f0fff0


Animation Resource - anim/slide_in_left.xml





Animation Resource - anim/slide_out_left.xml





Layout Resource for the Main Activity





















Main Activity

package com.example.viewflipper;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ToggleButton;
import android.widget.ViewFlipper;

public class MainActivity extends Activity implements OnClickListener{

private ToggleButton myToggleButton;
private Button previousView, nextView;
private Animation slide_in_left, slide_in_right, slide_out_left, slide_out_right;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//get references to our buttons and toogle button
myToggleButton = (ToggleButton) findViewById(R.id.toggleButton);
previousView = (Button) findViewById(R.id.previousView);
nextView = (Button) findViewById(R.id.nextView);

//attach onClick listeners to the buttons
myToggleButton.setOnClickListener(this);
previousView.setOnClickListener(this);
nextView.setOnClickListener(this);

//create animations
slide_in_left = AnimationUtils.loadAnimation(this, R.anim.slide_in_left);
slide_in_right = AnimationUtils.loadAnimation(this, R.anim.slide_in_right);
slide_out_left = AnimationUtils.loadAnimation(this, R.anim.slide_out_left);
slide_out_right = AnimationUtils.loadAnimation(this, R.anim.slide_out_right);

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

@Override
public void onClick(View v) {

//get reference to the view flipper
ViewFlipper myViewFlipper = (ViewFlipper) findViewById(R.id.myViewFlipper);
//set the animation for the view that enters the screen
myViewFlipper.setInAnimation(slide_in_right);
//set the animation for the view leaving th screen
myViewFlipper.setOutAnimation(slide_out_left);

switch (v.getId()) {
case R.id.nextView:
//show the next view
myViewFlipper.showNext();
break;

case R.id.previousView:
//show the next view
myViewFlipper.setInAnimation(slide_in_left);
myViewFlipper.setOutAnimation(slide_out_right);
myViewFlipper.showNext();
break;

case R.id.toggleButton:

if(myToggleButton.isChecked()){
//set flipper interval
myViewFlipper.setFlipInterval(6000);
//start flipping the views
myViewFlipper.startFlipping();
}
else{
//stop flipping the views
myViewFlipper.stopFlipping();
}
break;

}
}

}



Android ViewFlipper Animation exampleAndroid ViewFlipper new ViewAndroid ViewFlipper auto flip

You can download the source code View Flipper

Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
NB :: Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code, membeli hardware elektronika untuk kepentingan Perusahaan maupun Tugas Akhir (TA/SKRIPSI), Insyaallah Saya siap membantu, untuk Respon Cepat dapat menghubungi kami, melalui :

No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com


atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :

ٱلْحَمْدُ لِلَّهِ رَبِّ ٱلْعَٰلَمِين
Alhamdulilah hirobil alamin

وَ السَّلاَمُ عَلَيْكُمْ وَرَحْمَةُ اللهِ وَبَرَكَاتُهُ
wassalamualaikum warahmatullahi wabarakatuh


Artikel Android ViewFlipper Animation example , Diterbitkan oleh scodeaplikasi pada Kamis, 04 April 2013. Semoga artikel ini dapat menambah wawasan Anda. Website ini dipost dari beberapa sumber, bisa cek disini sumber, Sobat diperbolehkan mengcopy paste / menyebar luaskan artikel ini, karena segala yang dipost di public adalah milik public. Bila Sobat tertarik Ingin membuat software, membeli software, membeli source code ,Dengan Cara menghubungi saya Ke Email: Fajarudinsidik@gmail.com, atau No Hp/WA : (fajar) : 085369237896, (puat) : 085267792168.

Tawk.to