An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

Min SDK   16
Latest Commit   2016-03-22 14:16:10
License   unknown

Github   https://github.com/Q42/AndroidScrollingImageView

         

标签

使用APP客户端扫描二维码运行Demo


...

Q42




         

类似的还有....
cropiwa
Crescento Add curve at bottom of image views and relative layouts.
FrescoImageView FrescoImageView是一种Android平台的图像控件,可以异步加载网络图片、项目资源和本地图片,并且支持双指缩放、图片的基本处理以及Fresco的所有特性。
README

README.md

Scrolling Image View

An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.

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.2'
}

Sample app

Please see the sample app for some examples

Sample App

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" />

There are two attributes for the ScrollingImageView namely speed and src.

  • speed is the number of dp's to move the bitmap on each animation frame (may be a negative number)
  • src is the drawable to paint (must be a bitmap!)

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();

Parallax effect

In order to achieve a parallax effect, you can stack multiple ScrollingImageView's in a FrameLayout with different speeds. For example:

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

  <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" />
      
  <com.q42.android.scrollingimageview.ScrollingImageView
      android:id="@+id/scrolling_foreground"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      scrolling_image_view:speed="2.5dp"
      scrolling_image_view:src="@drawable/scrolling_foreground" />
</FrameLayout>