制作动画时,ObjectAnimator复制ImageView吗?

时间:2018-10-21 10:05:54

标签: android animation objectanimator

我正在尝试在正在制作的android应用程序的初始屏幕上对ImageView进行动画处理。

我想要做的只是一点点向上,它在开始时口吃,动画开始时复制,将原始图像视图保留在原处,并用另一个版本完成动画。

我刚刚开始使用Android Studio,所以我不确定是否忽略了一些愚蠢的事情,但是它使我把头发拔了哈哈

这是我的onCreate动画制作位置:

   @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    ImageView view = (ImageView) findViewById(R.id.splashscreen);


    ObjectAnimator ani = ObjectAnimator.ofFloat(view, "translationY", -100f);
    ani.setDuration(1500);
    ani.start();
}

活动的XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView
        android:id="@+id/splashscreen"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:src="@drawable/madtings" />
</LinearLayout>

该应用程序已完成很多工作,我只是想让它看起来像启动时的样子,并显示一个文本输入来代替imageview最初的位置。

0 个答案:

没有答案
相关问题