Android开发-引导页图片滑动效果

Android开发-引导页图片滑动效果

需求:

打开app引导页图片产生滑动动画效果,根据需要将图片设置渐变、滑动等效果。

Activity

```java

public class MainActivityextends AppCompatActivity {

private ImageView ivImg;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

ivImg=findViewById(R.id.iv_main_img);

ivImg.startAnimation(AnimationUtils.

loadAnimation(this, R.anim.anim_activity_welcome_set));

}

}

```

layout

```java

#Activity

```java

public class MainActivityextends AppCompatActivity {

private ImageView ivImg;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

ivImg=findViewById(R.id.iv_main_img);

ivImg.startAnimation(AnimationUtils.

loadAnimation(this, R.anim.anim_activity_welcome_set));

}

}

```

res/anim/anim_activity_welcome_set

```java

#Activity

```java

    android:fillAfter="true">

        android:duration="100"

        android:fillAfter="true"

        android:fromXScale="100%"

        android:fromYScale="100%"

        android:toXScale="130%"

        android:toYScale="100%">

        android:duration="3000"

        android:fillAfter="true"

        android:fromAlpha="0.4"

        android:toAlpha="1.0">

        android:duration="3000"

        android:fillAfter="true"

        android:fromXDelta="0"

        android:fromYDelta="0"

        android:toXDelta="-30%p"

        android:toYDelta="0">

```

你可能感兴趣的:(Android开发-引导页图片滑动效果)