Android – next and previous animation
When the user selects an item in the list, I pop up the popupwindow. Then when he slides left and right in the pop-up window, the data (in the pop-up window) becomes the previous and next item in the list respectively
I have done this. When the user swipes his finger to the right (the "next" action), when the current window on the left goes out from the right side of the screen, it looks like a new pop-up window sliding in from the left. Vice versa, the "back" motion
But the problem is, because I have made two styles for the two animations (left to middle, middle to right, right to middle, middle to left), and popupwindows does not update the display, when the user swipes to the right ("next") and then to the left ("back"), the animation looks unstable because the two animations overlap. The same happens when the sliding is reversed again
Now, if I call Update () after changing the animation, it will slide into the middle again. What's worse, what can I do to achieve the behavior I want?
thank you.
Editing: source code
This is the code I used to display the pop-up window for the first time:
popup1 = new PopupWindow(popupLayout, popup_width, popup_height, true);
popup1.setAnimationStyle(R.style.AnimationPopup);
popup1.showAtLocation(this.findViewById(R.id.main_container), Gravity.CENTER, 0, 0);
This is the code for the next () method:
if(popup2 != null) popup1 = popup2;
if(popup1 != null) {
popup2 = new PopupWindow(popupLayout, popup_width, popup_height, true);
popup2.setAnimationStyle(R.style.AnimationPopup);
popup1.dismiss();
popup2.showAtLocation(rootLayout, Gravity.CENTER, 0, 0);
}
This is the code for the prev () method:
if(popup2 != null) popup1 = popup2;
if(popup1 != null) {
popup2 = new PopupWindow(popupLayout, popup_width, popup_height, true);
popup2.setAnimationStyle(R.style.AnimationPopupReverse);
popup1.setAnimationStyle(R.style.AnimationPopupReverse);
popup1.dismiss();
popup2.showAtLocation(rootLayout, Gravity.CENTER, 0, 0);
}
This is the whole content of Java code. Animationpopup is an XML that can simply display slides from right to middle and hidden slides of animation from center to left
I have provided my first attempt code. Here, the changed animation takes effect after another pop-up window is displayed
resolvent:
If Android: hardwareedited = "true" is used in the list under the application tag, all animations will appear clearer. Even regular slide left / right animations will not show hardware acceleration