lsjwzh / RecyclerViewPager

Deprecated
Apache License 2.0
3.53k stars 667 forks source link

I want to attach recycelerviewPager's page each other or overlap #153

Open AshleighLovesChocolate opened 7 years ago

AshleighLovesChocolate commented 7 years ago

i want to attach recyclerviewPager's pages each other

like padding is 0

in the onScrolled >>>>>>>>>>

            for (int j = 0; j < childCount; j++) {
                View v = recyclerView.getChildAt(j);
                //往左 从 padding 到 -(v.getWidth()-padding) 的过程中,由大到小
                float rate = 0;
                if (v.getLeft() <= padding) {
                    if (v.getLeft() >= padding - v.getWidth()) {
                        rate = (padding - v.getLeft()) * 1f / v.getWidth();
                    } else {
                        rate = 1;
                    }
                    v.setScaleY(1 - rate * 0.1f);
                    v.setScaleX(1 - rate * 0.1f);  

                } else {
                    //往右 从 padding 到 recyclerView.getWidth()-padding 的过程中,由大到小
                    if (v.getLeft() <= recyclerView.getWidth() - padding) {
                        rate = (recyclerView.getWidth() - padding - v.getLeft()) * 1f / v.getWidth();
                    }
                    v.setScaleY(0.9f + rate * 0.1f);
                    v.setScaleX(0.9f + rate * 0.1f);
                    v.setTranslationX(-2.0f);
                    v.setAlpha((float)0.3);
                }
            }
        }

I tried to changed setScaleX -> nothing ( that means X doesn't scale so they can attach each other )

But the problem is text or images are shrinks because only Y has scaled

I want to make the whole view smaller than the focused item and attach to each other

is there any way to help me? thank you