Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android snippet - manipulating ImageSwitcher class
protected void onCreate(Bundle savedInstanceState) {
...
mImageSwitcher = (ImageSwitcher) findViewById(R.id.switcher1);
mImageSwitcher.setFactory(new ViewFactory() {
@Override
public View makeView() {
return new ImageView(GameActivity.this);
}
});
mImageSwitcher.setInAnimation(
AnimationUtils.loadAnimation(this, android.R.anim.fade_in));
mImageSwitcher.setOutAnimation(
AnimationUtils.loadAnimation(this,android.R.anim.fade_out));
}
...
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
mImageSwitcher.setImageResource(imageIDs[position]);
mImageSwitcher.animate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.