1

我在 LinearLayout 的底部有一个视图,可见性设置为 false。我希望它在出现时向下滑动,并且幻灯片动画是完美的,只是当它出现时,它出现在所有其他内容之上,当我希望它看起来好像它在其他对象之后(即较低z索引)。我尝试将其他对象带来 ToFont(),以及修改动画中的 zAdjustment,但没有运气。

这是我的动画:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:zAdjustment="bottom" 
    >

    <translate
        android:duration="@android:integer/config_mediumAnimTime"
        android:zAdjustment="bottom"
        android:fromYDelta="-100%"
        android:toYDelta="0" />

</set>

这是我的Java代码:

View optionsView = findViewById(R.id.options_layout);
Animation animation = AnimationUtils.loadAnimation(this.getContext(), R.anim.slide_top_down);
//findViewById(R.id.content_layout).bringToFront();
//this.invalidate();
optionsView.startAnimation(animation);
//this.addViewInLayout(optionsView,-1, optionsView.getLayoutParams());
if (optionsView.getVisibility() == View.GONE) {
    optionsView.setVisibility(View.VISIBLE);
} else {
    optionsView.setVisibility(View.VISIBLE);
}

有什么方法可以让我向下滑动而不出现在所有物体的前面吗?

4

0 回答 0