MovingImageView

介绍:

可以在屏幕上移动的自定义View。

运行效果:

使用说明:

XML

    <net.grobas.view.MovingImageView
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:src="@drawable/beach"
        app:miv_load_on_create="true"
        app:miv_max_relative_size="3"
        app:miv_min_relative_offset="0.1"
        app:miv_start_delay="1000"
        app:miv_repetitions="-1"
        app:miv_speed="100" />

属性

    app:miv_load_on_create (boolean) -> 默认true
app:miv_max_relative_size (float) -> 默认3.0f
app:miv_min_relative_offset (float) -> 默认0.2f
app:miv_start_delay (integer) -> 默认0
app:miv_repetitions (integer) -> 默认-1
app:miv_speed (integer) -> 默认50

JAVA

    MovingImageView image = (MovingImageView) findViewById(R.id.image);
    image.getMovingAnimator().setInterpolator(new BounceInterpolator());
    image.getMovingAnimator().setSpeed(100);
    image.getMovingAnimator().addCustomMovement().
            addDiagonalMoveToDownRight().
            addHorizontalMoveToLeft().
            addDiagonalMoveToUpRight().
            addVerticalMoveToDown().
            addHorizontalMoveToLeft().
            addVerticalMoveToUp().
            start();
已下载
0