必威betway-手机版唯一官网
做最好的网站

betway必威官网手机版

当前位置:必威betway > betway必威官网手机版 > 主要代码如下

主要代码如下

来源:http://www.jdxzx.net 作者:必威betway 时间:2019-12-26 16:21

韦德国际 ,自定义继承PagerAdapter子类PictureAdapter适配器创建的时候,newPictureAdapter()并没有执行里面的代码,这是怎么回事,求指点。主要代码如下:

packagecom.example.googleplay.holder;importjava.util.List;importcom.example.googleplay.R;importcom.example.googleplay.base.BaseHolder;importcom.example.googleplay.conf.Constants.URLS;importcom.example.googleplay.utils.BitmapHelper;importcom.example.googleplay.utils.LogUtils;importcom.example.googleplay.utils.UIUtils;importcom.lidroid.xutils.ViewUtils;importcom.lidroid.xutils.view.annotation.ViewInject;importandroid.support.v4.view.PagerAdapter;importandroid.support.v4.view.ViewPager;importandroid.view.View;importandroid.view.ViewGroup;importandroid.widget.ImageView;importandroid.widget.ImageView.ScaleType;importandroid.widget.LinearLayout;publicclassPictureHolderextendsBaseHolderListString{@ViewInject(R.id.item_home_picture_pager)ViewPagermViewPager;@ViewInject(R.id.item_home_picture_container_indicator)LinearLayoutmContainerIndicator;publicListStringmDatas;@OverridepublicViewinitHolderView(){Viewview=View.inflate(UIUtils.getContext(),R.layout.item_home_picture,null);//注入ViewUtils.inject(this,view);returnview;}@OverridepublicvoidrefreshHolderView(ListStringdatas){mDatas=datas;PictureAdapteradapter=newPictureAdapter();mViewPager.setAdapter(adapter);}classPictureAdapterextendsPagerAdapter{@OverridepublicintgetCount(){if(mDatas!=null){returnmDatas.size();}return0;}@OverridepublicbooleanisViewFromObject(Viewview,Objectobject){returnview==object;}@OverridepublicObjectinstantiateItem(ViewGroupcontainer,intposition){ImageViewiv=newImageView(UIUtils.getContext());iv.setScaleType(ScaleType.FIT_XY);iv.setImageResource(R.drawable.ic_default);//获取图片完整路径Stringuri=URLS.IMAGEBASEURL+mDatas.get(position);BitmapHelper.display(iv,uri);container.addView(iv);LogUtils.sf("instantiateItem--container.addView(iv)");returniv;}@OverridepublicvoiddestroyItem(ViewGroupcontainer,intposition,Objectobject){container.removeView((View)object);}}}

本文由必威betway发布于betway必威官网手机版,转载请注明出处:主要代码如下

关键词:

上一篇:现在暂时还是用ProgressDialog来显示

下一篇:没有了