Created
April 1, 2014 19:46
-
-
Save zyzo/3f84d5ec6fb58464b6fe to your computer and use it in GitHub Desktop.
Android snippet - manipulating ImageSwitcher class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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