AndroidScrollingImageView - 连续重复滚动展示图像的Android ImageView

jopen 9年前

一个Android视图显示连续重复滚动播放的图片。这可以被用来创建一个视差动画效果。

Example

Example

Installation

Step 1. Add the JitPack repository to your build file

repositories { // ... maven { url "https://jitpack.io" }  }

Step 2. Add the dependency in the form

dependencies {      compile 'com.github.Q42:AndroidScrollingImageView:1.0' }

Usage

In your Android layout file add:

<com.q42.android.scrollingimageview.ScrollingImageView      android:id="@+id/scrolling_background"      android:layout_width="match_parent"      android:layout_height="wrap_content"      scrolling_image_view:speed="1dp"      scrolling_image_view:src="@drawable/scrolling_background" />

Don't forget to add the namespace to your root XLM element

xmlns:scrolling_image_view="http://schemas.android.com/apk/res-auto"

In your Java code, you can start and stop the animation like this:

ScrollingImageView scrollingBackground = (ScrollingImageView) loader.findViewById(R.id.scrolling_background);  scrollingBackground.stop();  scrollingBackground.start();

项目主页:http://www.open-open.com/lib/view/home/1438936943864