码迷,mamicode.com
首页 > 其他好文 > 详细

自动轮播

时间:2016-06-30 21:34:45      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
    setContentView(R.layout.dianji_item);
        vp = (ViewPager) findViewById(R.id.vp);
        ima = (ImageView) findViewById(R.id.image01);
        tv1 = (TextView) findViewById(R.id.textView01);
        tv2 = (TextView) findViewById(R.id.shop_price01);
        
        
        Intent intent=getIntent();
        String name02=intent.getStringExtra("name");
        String image=intent.getStringExtra("ima");
        String jia=intent.getStringExtra("jiaqian");
        
        BitmapUtils bitmapUtils = new BitmapUtils(this);
        bitmapUtils.display(ima, image);
        tv1.setText(name02);
        tv2.setText(jia);
        
        
        list = new ArrayList<View>();
         ImageView img1 = new ImageView(this);
         ImageView img2 = new ImageView(this);
         
         BitmapUtils bitmapUtils1 = new BitmapUtils(this);
        bitmapUtils1.display(img1, "http://image.hmeili.com/yunifang/images/goods/85/goods_img/16052409165058122595118862.jpg");
        
         
         BitmapUtils bitmapUtils11 = new BitmapUtils(this);
        bitmapUtils11.display(img1, "http://image.hmeili.com/yunifang/images/goods/121/goods_img/160407143599311067893687095.jpg");
        
        list.add(img1);
        list.add(img2);
        

        vp.setAdapter(new PagerAdapter() {
            
            @Override
            public Object instantiateItem(ViewGroup container, int position) {
                container.addView(list.get(position));
                return list.get(position);
            }
            @Override
            public void destroyItem(ViewGroup container, int position,
                    Object object) {
                // TODO Auto-generated method stub
                container.removeView(list.get(position));
            }
            @Override
            public boolean isViewFromObject(View arg0, Object arg1) {
                // TODO Auto-generated method stub
                return arg0==arg1;
            }
            
            @Override
            public int getCount() {
                // TODO Auto-generated method stub
                return list.size();
            }
        });
    }

    

}

 

自动轮播

标签:

原文地址:http://www.cnblogs.com/zle-mr/p/5631248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!