Code example for ImageSwitcher

Methods: setImageResource

0
    } 
 
	private OnItemClickListener galListener = new OnItemClickListener() {    
		public void onItemClick(AdapterView<?> parent, View v, int position, long id) { 
			 
			imgSwi.setImageResource(AryBigPhoto[position]); 
    		Toast.makeText(GalleryImageSwitcherMe.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;
    }