Android ImageSwitcher - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ImageSwitcher class.

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));
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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;
    } 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
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;
		    } 
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setInAnimation, setOutAnimation, setFactory
     
    final int stub_id=R.drawable.stub;
    public void DisplayImage(final List<String> urls, final ImageSwitcher imageSwitcher)
    { 
    	 
    	imageSwitcher.setFactory(this); 
    	imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(context, 
                    android.R.anim.fade_in)); 
    	imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(context, 
                    android.R.anim.fade_out)); 
    	String url = urls.get(0); 
        imageViews.put(imageSwitcher, url); 
        final Bitmap bitmap=memoryCache.get(url); 
        if(bitmap!=null) { 
        	handler.post(new Runnable() { 
            	@Override 
				public void run() { 
            		imageSwitcher.setImageDrawable(new BitmapDrawable(bitmap)); 
            	} 
            }); 

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setId, 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);
        m_Switcher.setImageResource(imagelist[index]);
 
        //������ʾ���洴�������Բ��� 
        setContentView(main_view);
 
        //��������һ�š���ť 
        Button next = new Button(this);
        next.setId(BUTTON_DWON_ID);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setId, 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);
		m_Switcher.setImageResource(imagelist[index]);
		 
		//ÉèÖÃÏÔʾÉÏÃæ´´½¨µÄÏßÐÔ²¼¾Ö 
		setContentView(main_view);
 
		//´´½¨¡°ÏÂÒ»ÕÅ¡±°´Å¥ 
		Button next = new Button(this);
		next.setId(BUTTON_DWON_ID);
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setImageDrawable
    @Override 
    protected void onPostExecute(Bitmap result) {
	// we check if the user is still looking at the same photo 
	// if not, we don't refresh the main view 
	if (result != null && originalPosition == gallery.getSelectedItemPosition()) {
	    imageSwitcher.setImageDrawable(new BitmapDrawable((Bitmap) result));
	} 
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setImageResource
			@Override 
			public void onItemSelected(AdapterView<?> parent, View view, 
				int position , long id)
			{ 
				//��ʾ��ǰ��ѡ�е�ͼƬ 
				switcher.setImageResource(imageIds[position % imageIds.length]);
			} 
			@Override 
			public void onNothingSelected(AdapterView<?> parent){}			
		}); 
		//�����б�������ļ����� 
		grid.setOnItemClickListener(new OnItemClickListener()
		{ 
			@Override 
			public void onItemClick(AdapterView<?> parent
				, View view, int position, long id)
			{ 
				//��ʾ��������ͼƬ��ͼƬ 
				switcher.setImageResource(imageIds[position % imageIds.length]);
			} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android ImageSwitcher Questions & Answers:

See Code Examples for Android ImageSwitcher Methods: