android:仅为一个孩子应用clipChildren //////////////////////////// ListView保存下面的行布局。 ///////row_layout.xml/////// //////////////////////////// 我需要设置子对象“ImageView_child”的动画,并将其移到父对象之外, 我使用了以下方法: 禁用CliponParents(ImageView\u child); public void disableClipOnParents(视图五){ if(v.getParent()==null){ 返回; } if(视图组的v实例){ ((视图组)v).setClipChildren(false); } if(v.getParent()instanceof视图){ disableClipOnParents((视图)v.getParent()); } }

android:仅为一个孩子应用clipChildren //////////////////////////// ListView保存下面的行布局。 ///////row_layout.xml/////// //////////////////////////// 我需要设置子对象“ImageView_child”的动画,并将其移到父对象之外, 我使用了以下方法: 禁用CliponParents(ImageView\u child); public void disableClipOnParents(视图五){ if(v.getParent()==null){ 返回; } if(视图组的v实例){ ((视图组)v).setClipChildren(false); } if(v.getParent()instanceof视图){ disableClipOnParents((视图)v.getParent()); } },android,android-layout,android-animation,android-view,Android,Android Layout,Android Animation,Android View,它工作得很好,当设置ImageView\u子对象的动画时,它不再被其父对象剪裁。但是在滚动列表时,ListView\u grand\u parent也会出现在RelativeLayout\u grand\u parent和操作栏上 我的要求是: ImageView\u child不应被ListView\u grand\u parent和RelativeLayout\u grand\u parent剪切 ListView\u grand\u parent应被RelativeLayout\u gr

它工作得很好,当设置ImageView\u子对象的动画时,它不再被其父对象剪裁。但是在滚动列表时,ListView\u grand\u parent也会出现在RelativeLayout\u grand\u parent和操作栏上

我的要求是:

  • ImageView\u child不应被ListView\u grand\u parentRelativeLayout\u grand\u parent剪切
  • ListView\u grand\u parent应被RelativeLayout\u grand\u parent剪切

是否可以仅对一个子项禁用剪裁?

有趣的是,您是有意还是无意将行布局保留在父项视图中?我有意将行布局保留在父项视图中,因为它也包含其他子项。当您创建复杂布局时,使用“include tag”@KingofMasses我如何使用它?你能再解释一下吗。
<RelativeLayout
                android:id="@+id/RelativeLayout_grand_parent"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" >
                <ListView
                    android:id="@+id/ListView_grand_parent"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent" />
            </RelativeLayout>
////////////////////////////

ListView holds the below row layout. 

/////// row_layout.xml ///////
<RelativeLayout
                android:id="@+id/RelativeLayout_parent"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
                <ImageView
                    android:id="@+id/ImageView_child"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/heart_icon" />
            </RelativeLayout>
////////////////////////////

I need to animate the child "ImageView_child" and move it outside the parent,
than I used below method :

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