It means that although it animates, that does not mean the fragment itself is where the animation makes it appear to be. It will still receive OnClick events at the original position until it is physically moved.
You are probably using old-style animations (e.g., TranslateAnimation
), which were designed for transient effects, not permanent ones.
The reason I pointed you to a related question of mine was that many of the solutions, including my own solution use the new animator framework, which is designed for longer-lasting effects.
Also that example does not help me, I am trying to move it partially off screen, not just scrunch it up against an edge.
Particularly with respect to the animator framework, there is no material difference between "move it partially off screen" and "scrunch it up against an edge". For example, if you had read my solution, you would have seen a translateWidgets()
method demonstrating a horizontal slide of a set of widgets:
private void translateWidgets(int deltaX, View... views) {
for (final View v : views) {
v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
v.animate().translationXBy(deltaX).setDuration(ANIM_DURATION)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
v.setLayerType(View.LAYER_TYPE_NONE, null);
}
});
}
}
In your case, deltaX
would be whatever the appropriate value is to achieve your 20% effect (presumably 0.2f
times the container's width, or something along those lines), or to undo that effect when the full fragment should be seen.
My answer contains links to full sample projects, both for the native API Level 11 animators, and using the NineOldAndroids backport of the animator framework.