Android View Disappearing When Go Outside Of Parent

后端 未结 6 424
甜味超标
甜味超标 2020-12-01 02:38

I have a LinearLayout and ImageView inside this LinearLayout.

There is a translation effect for ImageView.

// v = ImageView    
ObjectAnimator anima         


        
6条回答
  •  盖世英雄少女心
    2020-12-01 03:08

    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

    android:clipChildren="false"
    android:clipToPadding="false"
    

    or in code

    viewGroup.setClipChildren(false);
    viewGroup.setClipToPadding(false);
    

提交回复
热议问题