ImageSwitcher1public class ImageSwitcher1 extends android.app.Activity implements ViewSwitcher.ViewFactory, AdapterView.OnItemSelectedListener
Fields Summary |
---|
private android.widget.ImageSwitcher | mSwitcher | private Integer[] | mThumbIds | private Integer[] | mImageIds |
Methods Summary |
---|
public android.view.View | makeView()
ImageView i = new ImageView(this);
i.setBackgroundColor(0xFF000000);
i.setScaleType(ImageView.ScaleType.FIT_CENTER);
i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
return i;
| public void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.image_switcher_1);
mSwitcher = (ImageSwitcher) findViewById(R.id.switcher);
mSwitcher.setFactory(this);
mSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_in));
mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
android.R.anim.fade_out));
Gallery g = (Gallery) findViewById(R.id.gallery);
g.setAdapter(new ImageAdapter(this));
g.setOnItemSelectedListener(this);
| public void | onItemSelected(android.widget.AdapterView parent, android.view.View v, int position, long id)
mSwitcher.setImageResource(mImageIds[position]);
| public void | onNothingSelected(android.widget.AdapterView parent)
|
|