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

Commit 65f046c

Browse files
committed
Update sample app and readme with an example of contiguous
1 parent 9bac32c commit 65f046c

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ In your Android layout file add:
3636
android:id="@+id/scrolling_background"
3737
android:layout_width="match_parent"
3838
android:layout_height="wrap_content"
39-
scrolling_image_view:speed="1dp"
39+
scrolling_image_view:speed="60dp"
40+
scrolling_image_view:contiguous="false"
4041
scrolling_image_view:source="@drawable/scrolling_background" />
4142
```
4243

43-
There are two attributes for the `ScrollingImageView` namely `speed` and `source`.
44-
* `speed` is the number of `dp`'s to move the bitmap per second (may be a negative number)
45-
* `source` is the drawable to paint
44+
There are three attributes for the `ScrollingImageView`:
45+
* `speed` is the number of `dp`'s to move the drawable per second (may be a negative number)
46+
* `source` is the drawable to paint. May refer to an array of drawables
47+
* `contiguous` When source is an array of drawables, `contiguous` determines their ordering.
48+
49+
false (default) for random ordering, true for the same order as in the array
4650

4751
Don't forget to add the namespace to your root XML element
4852
```xml
@@ -67,14 +71,14 @@ In order to achieve a parallax effect, you can stack multiple `ScrollingImageVie
6771
android:id="@+id/scrolling_background"
6872
android:layout_width="match_parent"
6973
android:layout_height="wrap_content"
70-
scrolling_image_view:speed="1dp"
74+
scrolling_image_view:speed="60dp"
7175
scrolling_image_view:source="@drawable/scrolling_background" />
7276

7377
<com.q42.android.scrollingimageview.ScrollingImageView
7478
android:id="@+id/scrolling_foreground"
7579
android:layout_width="match_parent"
7680
android:layout_height="wrap_content"
77-
scrolling_image_view:speed="2.5dp"
81+
scrolling_image_view:speed="150dp"
7882
scrolling_image_view:source="@drawable/scrolling_foreground" />
7983
</FrameLayout>
8084
```

sampleapp/src/main/res/layout/activity_main.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
style="@style/Base.TextAppearance.AppCompat.Title"
7878
android:layout_width="match_parent"
7979
android:layout_height="wrap_content"
80-
android:text="Left to right scrolling background"
80+
android:text="Left to right, fixed tile order"
8181
android:layout_marginTop="30dp"/>
8282

8383
<FrameLayout
@@ -90,13 +90,15 @@
9090
android:layout_height="wrap_content"
9191
android:layout_gravity="bottom"
9292
scrolling_image_view:speed="-60dp"
93+
scrolling_image_view:contiguous="true"
9394
scrolling_image_view:source="@drawable/scrolling_background" />
9495

9596
<com.q42.android.scrollingimageview.ScrollingImageView
9697
android:layout_width="match_parent"
9798
android:layout_height="wrap_content"
9899
android:layout_gravity="bottom"
99100
scrolling_image_view:speed="-114dp"
101+
scrolling_image_view:contiguous="true"
100102
scrolling_image_view:source="@drawable/scrolling_foreground" />
101103
</FrameLayout>
102104

0 commit comments

Comments
 (0)