Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glide加载多张网络图片,CircleIndicator不居中显示。。。帮忙指点一下。。。 #36

Open
qichu opened this issue Sep 13, 2018 · 0 comments

Comments

@qichu
Copy link

qichu commented Sep 13, 2018

private class HeaderAdapter extends PagerAdapter {

    @Override
    public Object instantiateItem(ViewGroup container, final int position) {
        ImageView imageView = new ImageView(AircraftInfoActivity.this.getApplicationContext());
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        //  imageView.setImageResource(images[position]);

        if (imagesUrl.size() > 0) {
            
            Glide.with(AircraftInfoActivity.this)
                    .load(imagesUrl.get(position))
                    .placeholder(R.drawable.ic_loading) 
                    .error(R.drawable.ic_fail) 
                    .into(imageView);

            container.addView(imageView);
            imageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                }
            });
            return imageView;

        } else {
            return null;
        }
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }

    @Override

    public int getCount() {
        return imagesUrl.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant