gpt4 book ai didi

安卓 ViewAnimator : animation while changing viewstub child

转载 作者:太空狗 更新时间:2023-10-29 15:20:59 27 4
gpt4 key购买 nike

这是我的问题:

我有一个像这样的 ViewAnimator:

<ViewAnimator
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/viewanimator">

<ViewStub
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/form_viewstub"
android:inflatedId="@+id/form_view"
android:layout="@layout/form_layout"/>

<ViewStub
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/history_viewstub"
android:inflatedId="@+id/history_view"
android:layout="@layout/history_layout"/>

<ViewStub
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/call_viewstub"
android:inflatedId="@+id/call_view"
android:layout="@layout/call_layout"/>

</ViewAnimator>

当我为当前之后的 View stub 设置动画时,没有问题。问题是,当我之前尝试为 viewstub 制作动画时,我看不到动画。这是一个具体的例子:

当我尝试使用以下动画为 id/history_viewstub 设置动画并且 id/call_viewstub 是当前显示的布局时,我没有看到任何东西(我想动画是在当前 View 后面播放)

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator="@android:anim/accelerate_interpolator"
android:fromXScale="0.0"
android:toXScale="1.0"
android:fromYScale="0.0"
android:toYScale="1.0"
android:pivotX="1.0"
android:pivotY="0.0"
android:fillAfter="true"
android:duration="600"/>
<translate
android:fromXDelta="100%"
android:toXDelta="0"
android:duration="600"/>
</set>

有人遇到过这个问题吗?

有没有办法像在 Web 开发中那样为 View stub 指定 z-index


编辑

使用 ZAdjustment 属性不能解决问题

最佳答案

我确定您已经解决了这个问题,但是由于没有答案...您应该可以使用 android:zAdjustment="top"

关于安卓 ViewAnimator : animation while changing viewstub child,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7838198/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com