After a TranslateAnimation, the OnClickListener on view translated is not translated. I tried overriding getHitRect in a custom LinearLayout but without success. I also tried to use a touchdelegate and all other suggestions found on the whole internet without success :)
TranslateAnimation open = new TranslateAnimation(0, displayWidth - ivTimelineWidth, 0, 0);
open.setDuration(1000);
open.setFillAfter(true);
llMapContent.startAnimation(open);
Please help me :)
Julien
If I am understanding your problem correctly, you want to click on something after it's been translated and it's not registering the onTouch of the something. This problem is occurring because TranslateAnimation does not actually move the object, just the pixels on the screen. You would call the onTouch if touch the area where the item was. To actually move the object rather than the pixels on the screen I recommend using this code snippet:
MarginLayoutParams marginParams = new MarginLayoutParams(someobject.getLayoutParams());
marginParams.setMargins(xx, xx, xx, xx);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(marginParams);
someobject.setLayoutParams(layoutParams);
You should probably place this in the onAnimationEnd
or onAnimationStart
methods. Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With