Best code examples for Android ImageSwitcher class (android.widget.ImageSwitcher)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ImageSwitcher class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android ImageSwitcher examples from Open Source projects
This code example shows how to use the following methods: getCurrentView, setInAnimation, setOutAnimation, showNext, showPrevious
This code example shows how to use the following methods: startAnimation
	} 
 
	public void goNext() { 
		Animation in = AnimationUtils.loadAnimation(context,
				android.R.anim.fade_in);
		imageSwitcher.startAnimation(in);
	} 
 
	public void goPrevious() { 
		Animation out = AnimationUtils.loadAnimation(context,
				android.R.anim.fade_in);
		imageSwitcher.startAnimation(out);
	} 
 
	public ImageView imageView() {
		ImageView i = new ImageView(context);
		i.setScaleType(ImageView.ScaleType.FIT_CENTER);
		i.setLayoutParams(new ImageSwitcher.LayoutParams(
				android.view.ViewGroup.LayoutParams.MATCH_PARENT,
				android.view.ViewGroup.LayoutParams.MATCH_PARENT));
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setImageResource
        g.setAdapter(new ImageAdapter(this));
        g.setOnItemSelectedListener(this);
    } 
 
    public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
        mSwitcher.setImageResource(mImageIds[position]);
    } 
 
    public void onNothingSelected(AdapterView<?> parent) {
    } 
 
    public View makeView() {
        ImageView i = new ImageView(this);
        i.setBackgroundColor(0xFF000000);
        i.setScaleType(ImageView.ScaleType.FIT_CENTER);
        i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.MATCH_PARENT));
        return i;
    } 
 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setId, setOnClickListener, setImageResource, setFactory
		super.onCreate(savedInstanceState);
 
		// 创建一个线性布局LinearLayout 
		LinearLayout main_view = new LinearLayout(this);
		// 创建ImageSwitcher对象 
		m_Switcher = new ImageSwitcher(this);
		// 在线性布局中添加ImageSwitcher视图 
		main_view.addView(m_Switcher);
		// 设置ImageSwitcher对象的ID 
		m_Switcher.setId(SWITCHER_ID);
		// 设置ImageSwitcher对象的数据源 
		m_Switcher.setFactory(this);
		// added by Tom Xue, same function as "next Button" 
		// so that its SWITCHER_ID is useful 
		m_Switcher.setOnClickListener(this);
		// m_Switcher is the 1st View (the image, see above addView) on the 
		// screen, below function makes it on screen at the very beginning, by 
		// Tom Xue 
		m_Switcher.setImageResource(imagelist[index]);
 

6
CodeRank
This code example shows how to use the following methods: setId, setImageDrawable, setInAnimation, setOutAnimation
		         } 
		         return row;
		    } 
		     
		    private View createImageSwitch(int x, int y, Drawable img){
		    	ImageSwitcher imageSwitcher=new ImageSwitcher(getApplicationContext());
		    	imageSwitcher.setId(100*x+y);
		    	 
		    	imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
		                android.R.anim.fade_in));
		        imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
		                android.R.anim.fade_out));
		        imageSwitcher.setImageDrawable(img);
		//        imageSwitcher.set 
		  
		    
		    	return imageSwitcher;
		    } 
	} 
 
Full Snippet Info
6
CodeRank
Related Android ImageSwitcher Questions & Answers:
See Code Examples for Android ImageSwitcher Methods: