Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/186.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在布局之间切换时进行Android动画剪辑_Android_Animation_Imageview - Fatal编程技术网

在布局之间切换时进行Android动画剪辑

在布局之间切换时进行Android动画剪辑,android,animation,imageview,Android,Animation,Imageview,我有一个相当复杂的布局。我使用一个相对布局作为根,然后在它里面我有一些表视图和一些进一步的嵌套。当我在这些布局之间设置imageview动画时,我的图像剪辑。我在父布局上有一个背景,动画看起来像是在它下面。我已经在所有布局上设置了android:clipChildren=“false”和android:clipToPadding=“false”。我还设置了anim.setzaadjustment(Animation.ZORDER_TOP);在我所有的动画上。我做错了什么 编辑:到目前为止,我至少

我有一个相当复杂的布局。我使用一个相对布局作为根,然后在它里面我有一些表视图和一些进一步的嵌套。当我在这些布局之间设置imageview动画时,我的图像剪辑。我在父布局上有一个背景,动画看起来像是在它下面。我已经在所有布局上设置了android:clipChildren=“false”和android:clipToPadding=“false”。我还设置了anim.setzaadjustment(Animation.ZORDER_TOP);在我所有的动画上。我做错了什么

编辑:到目前为止,我至少发现了两个bug。android:background=使用十六进制颜色会导致重大动画问题。表格布局下面似乎还有一个导致剪切的regoin。我在框架布局中也看到了同样的情况。一旦我真的让我的东西按我想要的方式工作,我会添加一个答案。我觉得只使用线性布局是解决方案

下面是一些产生问题的示例代码。如果删除两个子相对布局,则动画将按预期完成


爪哇:

XML:



我希望能给你一个更好的答案,但我解决了这个问题,将我想要制作动画的对象添加到顶层视图,在那里制作动画,然后将其隐藏。不是很满意,你找到更好的方法了吗?

我也有同样的问题,几天后我找到了解决办法。。。thanx至:

我想出了解决这个问题的办法。这条线索来自这样一个事实,即当显示视图时,一切正常。显然,当动画运行时,该节目强制进行的更新发生在背景中,不会导致闪烁。当我们隐藏视图时,在onAnimationEnd()的后端添加一个短动画会使闪烁消失

下面是工作代码中的新OnAndMationEnd()

    public void onAnimationEnd(Animation animation) {
             animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 0.0f);
                    animation.setDuration(1);
                    mPlayer0Panel.startAnimation(animation);
    }

诀窍是将setClipChildren设置为包含视图的布局。

修复了剪辑问题;我不知道它是否能解决你的问题。我已经看了一半了&只是注意到它已经超过一年了!为什么它在安卓问题列表中几乎排在首位?
<RelativeLayout android:id="@+id/relativeParentLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:clipToPadding="false">
    <RelativeLayout android:id="@+id/relativeParentLayout1"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="150dip" android:background="#440000"
        android:layout_alignParentTop="true" android:clipChildren="false"
        android:clipToPadding="false">
        <ImageView android:layout_height="wrap_content" android:id="@+id/ImageView01"
            android:layout_width="wrap_content" android:src="@drawable/card_back"
            android:layout_weight="0" android:layout_alignParentTop="true" />


        <ImageView android:layout_height="wrap_content" android:id="@+id/ImageView03"
            android:layout_width="wrap_content" android:src="@drawable/card_back"
            android:layout_weight="0" android:layout_gravity="center_vertical"
            android:layout_alignParentRight="true" />
    </RelativeLayout>
    <RelativeLayout android:id="@+id/relativeParentLayout2"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="150dip" android:background="#000044"
        android:layout_alignParentBottom="true" android:clipChildren="false"
        android:clipToPadding="false">

        <ImageView android:layout_height="wrap_content"
            android:layout_below="@+id/LinearLayout01" android:id="@+id/ImageView05"
            android:layout_width="wrap_content" android:src="@drawable/card_back"
            android:layout_weight="0" android:layout_alignParentBottom="true" />
    </RelativeLayout>
</RelativeLayout>
    public void onAnimationEnd(Animation animation) {
             animation = new TranslateAnimation(0.0f, 0.0f, 0.0f, 0.0f);
                    animation.setDuration(1);
                    mPlayer0Panel.startAnimation(animation);
    }