yuyakaido / CardStackView

📱Tinder like swipeable card view for Android
Apache License 2.0
2.37k stars 448 forks source link

View element with the wrong size if the CardView contains padding. #218

Open extmkv opened 5 years ago

extmkv commented 5 years ago

After I added padding to the CardStackView and clipToPading=false the elements start to have the wrong width.

The only solution I founded to solve the problem is to calculate the element size inside of the update function:

private void update(RecyclerView.Recycler recycler) {
...
 for (int i = state.topPosition; i < state.topPosition + setting.visibleCount && i < getItemCount(); i++) {
            View child = recycler.getViewForPosition(i);

            ViewGroup.LayoutParams params = child.getLayoutParams();
            params.width = parentRight - parentLeft;
            params.height = parentBottom - parentTop;
            child.setLayoutParams(params);

            addView(child, 0);
...

Do you known any solution to this problem?

lxxself commented 4 years ago

same problem