Is it possible to do change programmatically the current card to a new position with a slide animation ?
The following code only teleport to the chosen position :
cardScrollView.setSelection(cardScrollView.getSelectedItemPosition() - 1);
Is it possible to do change programmatically the current card to a new position with a slide animation ?
The following code only teleport to the chosen position :
cardScrollView.setSelection(cardScrollView.getSelectedItemPosition() - 1);
I didn't find a way to simulate a slide animation like the one when you slide manually, but this solution was good enough for me :
cardScrollView.setSelection(cardScrollView.getSelectedItemPosition() - 1);
cardScrollView.startAnimation(AnimationUtils.makeInAnimation(cardScrollView.getContext(), true));
Your new slide will have a slide animation from the right or the left depending if the second argument if true or false.
Perfect timing! This was just added to the GDK in XE21. Check out the new CardScrollView.animate
method, which allows you to slide to an existing card as well as insert and delete cards with animations.