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 LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT));
return i;
| public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
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.setSelectorSkin(getResources().getDrawable(android.R.drawable.box));
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)
|
|