3

ここに私の問題があります:

次のような 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>

現在の後にあるビュータブをアニメーション化する場合、問題はありません。問題は、以前にビュータブをアニメーション化しようとすると、アニメーションが表示されないことです。具体的な例を次に示します。

id/history_viewstub次のアニメーションでアニメーション化しようとするid/call_viewstubと、現在表示されているレイアウトでは何も表示されません (アニメーションは現在のビューの背後で再生されていると思います)

<?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>

誰かがすでにこの問題に直面していますか?

z-indexWeb 開発のようにビュータブにa を指定する方法はありますか?


編集

プロパティを使用してZAdjustmentも問題が解決しない

4

3 に答える 3

1

この問題はすでに解決されていると思いますが、答えがないので... を使用できるはずですandroid:zAdjustment="top"

于 2012-03-09T21:10:43.827 に答える
0

このView.bringToFrontを使用できます。

このメソッドは、ビューを子リストの最後に移動します。したがって、そのおよび他のビューのインデックスは変更されます。これに注意してください。

于 2013-07-16T11:38:34.360 に答える
-1

クラスの機能を実際に使用しているのではViewAnimatorなく、継承されたクラスだけを使用しているように思えますFrameLayout

ビューの遷移をアニメーション化するには、android:inAnimationandroid:outAnimationプロパティを設定し、またはとViewAnimatorを使用してコードから遷移を開始する必要があります。setDisplayedChild()showNext()showPrevious()

于 2011-10-29T08:35:50.573 に答える