Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 49e038a

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 6724e3f + 6732020 commit 49e038a

1 file changed

Lines changed: 67 additions & 1 deletion

File tree

README.md

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,67 @@
1-
# Scrolling Image View
1+
# Scrolling Image View
2+
3+
An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.
4+
5+
## Example
6+
![Example](https://raw.githubusercontent.com/Q42/AndroidScrollingImageView/master/preview.gif)
7+
8+
##Installation
9+
*Step 1.* Add the JitPack repository to your build file
10+
```gradle
11+
repositories {
12+
// ...
13+
maven { url "https://jitpack.io" }
14+
}
15+
```
16+
*Step 2.* Add the dependency in the form
17+
```gradle
18+
dependencies {
19+
compile 'com.github.Q42:AndroidScrollingImageView:1.0'
20+
}
21+
```
22+
23+
## Usage
24+
In your Android layout file add:
25+
```xml
26+
<com.q42.android.scrollingimageview.ScrollingImageView
27+
android:id="@+id/scrolling_background"
28+
android:layout_width="match_parent"
29+
android:layout_height="wrap_content"
30+
scrolling_image_view:speed="1dp"
31+
scrolling_image_view:src="@drawable/scrolling_background" />
32+
```
33+
34+
Don't forget to add the namespace to your root XLM element
35+
```xml
36+
xmlns:scrolling_image_view="http://schemas.android.com/apk/res-auto"
37+
```
38+
39+
In your Java code, you can start and stop the animation like this:
40+
```java
41+
ScrollingImageView scrollingBackground = (ScrollingImageView) loader.findViewById(R.id.scrolling_background);
42+
scrollingBackground.stop();
43+
scrollingBackground.start();
44+
```
45+
46+
## Parallax effect
47+
In order to achieve a parallax effect, you can stack multiple `ScrollingImageView`'s in a `FrameLayout` with different speeds. For example:
48+
```xml
49+
<FrameLayout
50+
android:layout_width="match_parent"
51+
android:layout_height="wrap_content">
52+
53+
<com.q42.android.scrollingimageview.ScrollingImageView
54+
android:id="@+id/scrolling_background"
55+
android:layout_width="match_parent"
56+
android:layout_height="wrap_content"
57+
scrolling_image_view:speed="1dp"
58+
scrolling_image_view:src="@drawable/scrolling_background" />
59+
60+
<com.q42.android.scrollingimageview.ScrollingImageView
61+
android:id="@+id/scrolling_foreground"
62+
android:layout_width="match_parent"
63+
android:layout_height="wrap_content"
64+
scrolling_image_view:speed="2.5dp"
65+
scrolling_image_view:src="@drawable/scrolling_foreground" />
66+
</FrameLayout>
67+
```

0 commit comments

Comments
 (0)