xmuSistone / CardSlidePanel

enable users to slide card to the left or right smoothly and continuously
2.39k stars 516 forks source link

Enable looping and CardStack Gravity #67

Closed Hbworld closed 7 years ago

Hbworld commented 7 years ago

i was wondering if i can enable looping through the cards and also changing the CardStack Gravity from Bottom to Top.

xmuSistone commented 7 years ago
  1. u r able to loop the cards in the adapter logic.

    slidePanel.setAdapter(new CardAdapter() {
    
        @Override
        public int getCount() {
            return Integer.maxValue();
        }
    
        @Override
        public void bindView(View view, int index) {
            index = index % dataList.size();
            viewHolder.bindData(dataList.get(index));
        }
    });
  2. wanna to change the offset direction from bottom to top? Just modify this param:

    card:itemMarginTop="-10dp"