Android View Disappearing When Go Outside Of Parent

Eray picture Eray · Aug 5, 2013 · Viewed 35.7k times · Source

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.

How can i fix it without modify LinearLayout's height.

Answer

JuniKim picture JuniKim · Aug 5, 2013

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.