自动轮播
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了自动轮播相关的知识,希望对你有一定的参考价值。
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(); } }); } }
以上是关于自动轮播的主要内容,如果未能解决你的问题,请参考以下文章