Android Translate动画不在前面

Android Translate动画不在前面,android,android-animation,Android,Android Animation,我有以下XML代码,它不是一个活动,而是将通过许多活动回收的组件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"

我有以下XML代码,它不是一个活动,而是将通过许多活动回收的组件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#73808080">

    <LinearLayout android:layout_weight="1" android:orientation="vertical" android:layout_height="0dp" android:layout_width="match_parent"/>
    <LinearLayout android:layout_weight="30" android:orientation="horizontal" android:layout_height="0dp" android:layout_width="match_parent">
            <LinearLayout android:layout_weight="1" android:layout_height="match_parent" android:layout_width="0dp"/>
            <LinearLayout android:layout_weight="10" android:layout_height="match_parent" android:layout_width="0dp">
                <LinearLayout android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent"/>
                <LinearLayout android:layout_weight="18" android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical">
                    <TextView android:id="@+id/roundLabel" android:layout_weight="4" android:layout_width="match_parent" android:layout_height="0dp" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text="Round"/>
                    <TextView android:id="@+id/roundValue" android:layout_weight="10" android:layout_width="match_parent" android:layout_height="0dp" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text="1" android:textStyle="bold"/>
                    <TextView android:id="@+id/ofLabel" android:layout_weight="4" android:layout_width="match_parent" android:layout_height="0dp" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text="of"/>
                    <TextView android:id="@+id/roundsLabel" android:layout_weight="6" android:layout_width="match_parent" android:layout_height="0dp" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text="10" android:textStyle="bold"/>
                </LinearLayout>
                <LinearLayout android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent"/>
            </LinearLayout>
            <LinearLayout android:layout_weight="30" android:layout_height="match_parent" android:layout_width="0dp" android:orientation="vertical">
                <OpenDarts.Android.Components.Label android:id="@+id/playerNameLabel" android:layout_weight="4" android:layout_width="match_parent" android:layout_height="0dp" app:text="Player 1"/>
                <LinearLayout android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp"/>
                <LinearLayout android:layout_weight="16" android:layout_width="match_parent" android:layout_height="0dp" android:orientation="horizontal">
                    <com.makeramen.roundedimageview.RoundedImageView android:id="@+id/userPhoto" android:layout_weight="10" android:src="@drawable/avatar" android:scaleType="fitCenter" android:adjustViewBounds="true" app:riv_corner_radius="30dip" app:riv_corner_radius_top_left="30dip" app:riv_corner_radius_top_right="30dip" app:riv_corner_radius_bottom_right="30dip" app:riv_corner_radius_bottom_left="30dip" app:riv_border_width="0dip" app:riv_mutate_background="true" app:riv_tile_mode="clamp" app:riv_oval="true" android:layout_width="0dp" android:layout_height="match_parent"/>
                    <LinearLayout android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent"/>
                    <LinearLayout android:layout_weight="10" android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical">
                        <FrameLayout android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp">
                            <ImageView android:id="@+id/dart1" android:src="@drawable/dart" android:adjustViewBounds="true" android:layout_height="match_parent" android:layout_width="match_parent"/>
                            <TextView android:id="@+id/dart1Value" android:layout_width="match_parent" android:layout_height="match_parent" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text=""/>
                        </FrameLayout>
                        <FrameLayout android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp">
                            <ImageView android:id="@+id/dart2" android:src="@drawable/dart" android:adjustViewBounds="true" android:layout_height="match_parent" android:layout_width="match_parent"/>
                            <TextView android:id="@+id/dart2Value" android:layout_width="match_parent" android:layout_height="match_parent" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text=""/>
                        </FrameLayout>
                        <FrameLayout android:layout_weight="1" android:layout_width="match_parent" android:layout_height="0dp">
                            <ImageView android:id="@+id/dart3" android:src="@drawable/dart" android:adjustViewBounds="true" android:layout_height="match_parent" android:layout_width="match_parent"/>
                            <TextView android:id="@+id/dart3Value" android:layout_width="match_parent" android:layout_height="match_parent" android:autoSizeTextType="uniform" android:gravity="center" android:fontFamily="@font/segoeui" android:textColor="@android:color/white" android:text=""/>
                        </FrameLayout>
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
            <LinearLayout android:layout_weight="1" android:layout_height="match_parent" android:layout_width="0dp"/>
    </LinearLayout>
    <LinearLayout android:layout_weight="1" android:orientation="vertical" android:layout_height="0dp" android:layout_width="match_parent"/>
</LinearLayout>
我曾尝试使用dart1.BringToFront(),但没有成功


PS:这是Xamarin.Android,但API与本机SDK相同,只是有一些细微的变化,比如名称是Pascal大小写,还有一些细微的变化。

如果您想让ImageView保持在一切之上,您可以将外部
线性布局
更改为
相对布局
,然后将Imageview放在xml的底部。它将始终停止在FrameLayout,因为它在其中。您必须为FrameLayout本身设置动画,或将ImageView放入父线性布局中
TranslateAnimation TranslateAnimation1 = new TranslateAnimation(0, 2000, 0, 0);
TranslateAnimation1.Duration = duration;
TranslateAnimation1.FillAfter = true;
TranslateAnimation1.AnimationEnd += TranslateAnimation1_AnimationEnd;
TranslateAnimation1.ZAdjustment = ContentZorder.Top;
dart1.StartAnimation(translateAnimation);