Code example for ImageSwitcher

Methods: setImageResource

0
	} 
 
	private OnItemClickListener glListener = new OnItemClickListener() {
		public void onItemClick(AdapterView<?> parent, View v, int position, 
				long id) { 
			imgSwi.setImageResource(AryBigPhoto[position]); 
			Toast.makeText(Ch07GalleryImageSwitcher.this, 
					"照片編號為" + (position + 1), Toast.LENGTH_SHORT).show(); 
		} 
	}; 
 
	public View makeView() {
		ImageView v = new ImageView(this);
		v.setBackgroundColor(0xff000000);
		v.setScaleType(ImageView.ScaleType.FIT_CENTER);
		v.setLayoutParams(new ImageSwitcher.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		return v;
	} 
 
	public class ImageAdapter extends BaseAdapter {