clipChildren is not working

后端 未结 5 1821
傲寒
傲寒 2020-12-30 23:51

In my application i am trying to move images using animation. When i try to animate the image (imageView2 or imageView4) to imageView1

5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 00:28

    One of the parents of your RelativeLayout might be clipping children (sometimes compatibility libraries add a mystery ViewGroup such as NoSaveStateFrameLayout for example). I've used something like this in the past with success to disable clip on all parents of a view:

    public void disableClipOnParents(View v) {
        if (v.getParent() == null) {
            return;
        }
    
        if (v instanceof ViewGroup) {
            ((ViewGroup) v).setClipChildren(false);
        }
    
        if (v.getParent() instanceof View) {
            disableClipOnParents((View) v.getParent());
        }
    }
    

提交回复
热议问题