Closed LassassinX closed 3 years ago
I found the solution!
You need to implement another CardStackLayoutManager!!
`FloatingActionButton rewindButton = (FloatingActionButton)rootView.findViewById(R.id.rewind_button);
rewindButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(mContext, "click", Toast.LENGTH_SHORT).show(); RewindAnimationSetting settings = new RewindAnimationSetting.Builder() .setDirection(Direction.Bottom) .setDuration(Duration.Normal.duration) .setInterpolator( new DecelerateInterpolator()) .build();
CardStackLayoutManager cardStackLayoutManager2 = new CardStackLayoutManager(mContext);
cardStackLayoutManager2.setRewindAnimationSetting(settings);
cardStackView.setLayoutManager(cardStackLayoutManager2);
cardStackView.smoothScrollToPosition(0);
}
});`
Thanks
What does mContext get replaced with? I'm new to android studio and I'm having the same issue with rewind not working.
With getApplicationContext() or this or getBaseContext()
Thank you for helping me out. When I add in the code you put above and click on the rewind button, it rewinds totally to the first item instead of the previous item. Do you know why this is happening? I've also tried replacing the smoothScrollToPosition(0) with rewind() but it does the same thing.
because it is smoothScrollToPosition(0), Card at position 0 is the first card The code should be smoothScrollToPosition (getTopPosition() - 1)
it is not working
Library version: 2.3.4.
I try calling the cardStackView.rewind(), but it doesnt work. I call this method in rewindbtnPressed(). Please help
my code:
public class MainActivity extends AppCompatActivity {
}