即使设置为 false,clipChildren 也不起作用? [英] clipChildren is not working even though set to false?

查看:49
本文介绍了即使设置为 false,clipChildren 也不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我尝试使用动画移动图像.当我尝试为图像制作动画时,即使我在每个 xml 块中使用 clipChildren false

In my application I am trying to move images using animation. When I try to animate the image is cutting even though I use clipChildren false in every xml block

    <RelativeLayout
        android:id="@+id/baselayout"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/imageView1"
        android:clipChildren="false"
        android:clipToPadding="false" >

推荐答案

RelativeLayout 的父级之一可能正在裁剪子级(有时兼容性库会添加一个神秘的 ViewGroup,例如 NoSaveStateFrameLayout 例如).我过去曾使用过类似的方法成功禁用视图的所有父级的剪辑:

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());
    }
}

这篇关于即使设置为 false,clipChildren 也不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆