ToxicBakery / ViewPagerTransforms

Library containing common animations needed for transforming ViewPager scrolling for Android v13+.
https://toxicbakery.github.io/ViewPagerTransforms/
Apache License 2.0
2.57k stars 489 forks source link

viewpager PageAdapter #63

Closed 7449 closed 6 years ago

7449 commented 7 years ago

I just started thinking that I used the problem, and then download the Sample write their own Adapter, found that the click event is still a problem

  @Override
        public Object instantiateItem(ViewGroup container, final int position) {
            ImageView img = new ImageView(container.getContext());
            img.setBackgroundResource(image[position]);
            img.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Log.i("TRANSFORMS", "onClickListener");
                }
            });
            container.addView(img);
            return img;
        }

OnClicklistener has been unable to respond to Log, through the code found ABaseTransformer onPreTransform

        if (hideOffscreenPages()) {
            page.setAlpha(position <= -1f || position >= 1f ? 0f : 1f);
            page.setEnabled(false);
        } else {
            page.setEnabled(true);
            page.setAlpha(1f);
        }

hideOffscreenPages always returns true ,Then setEnabled (false)

Is it a problem with my use? thanks