I have a LinearLayout and ImageView inside this LinearLayout.
There is a translation effect for ImageView.
// v = ImageView
ObjectAnimator animation2 = ObjectAnimator.ofFloat(v, "translationY", 200);
animation2.setDuration(3000);
animation2.setTarget(v);
animation2.start();
Animation working but it's disappearing when ImageView go outside of LinearLayout.
You can see problem here : http://screenr.com/zoAH
How can i fix it without modify LinearLayout's height.
Two attributes exist that may cause this to happen: clipChildren and clipToPadding. You'll need to set clipChildren to false for each parent ViewGroup whose bounds the object will animate out of. You also need to set clipToPadding to the immediate parent (and maybe more, but I haven't seen a case for it yet).
You can set both attributes in the XML
or in code
My implementation. It can probably help somebody:
call
setAllParentsClip(yourView, false);
to disable the clipping in all the parents.In my case clipChildren did nothing but
clipToPadding="false"
fixed the problem. Go figure.Find the ViewGroup that the ImageView belongs to and apply ViewGroup.setClipChildren(false). By default, the drawing of the children is limited to the bounds of the parent ViewGroup.
Get the view height, then add a percentage of the height to where it will slide to