Git Product home page Git Product logo

Comments (3)

AlexFugui avatar AlexFugui commented on July 17, 2024

忘了说RollPagerAdapter继承的LoopPagerAdapter

from rollviewpager.

AlexFugui avatar AlexFugui commented on July 17, 2024

public class RollPagerAdapter extends LoopPagerAdapter {
private Context context;
private List imageList;

public RollPagerAdapter(RollPagerView viewPager, Context context, List<String> imageList) {
    super(viewPager);
    this.context = context;
    this.imageList = imageList;
}

public void setDate(List<String> imageList) {
    if (this.imageList != null) {
        this.imageList = imageList;
        this.notifyDataSetChanged();
    } else {
        Toast.makeText(context, "加载数据错误", Toast.LENGTH_SHORT).show();
    }
}

@Override
public View getView(ViewGroup container, int position) {
    View view = View.inflate(context, R.layout.item_rollviewpager, null);
    Holder holder = new Holder();
    holder.rollPagerView_sim = (SimpleDraweeView) view.findViewById(R.id.rollPagerView_sim);
    holder.rollPagerView_sim.setImageURI(imageList.get(position));
    return view;
}

@Override
public int getRealCount() {
    return imageList.size();
}

private class Holder {
    SimpleDraweeView rollPagerView_sim;
}

}

from rollviewpager.

AlexFugui avatar AlexFugui commented on July 17, 2024

已解决
我访问网络数据返回的是图片url的集合 在异步线程中遍历添加数据
for(String string:List){
myList.add(imageUrl);
adapter.notifyDataSetChanged();//添加这一行就可以了
}
但是有缺陷 每次打开页面时候显示的是第四张图片 我一共加载五张
至少这么不崩溃了 有其他解决方法我再来发吧

from rollviewpager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.