{"id":13396288,"url":"https://github.com/Q42/AndroidScrollingImageView","last_synced_at":"2025-03-13T22:32:04.140Z","repository":{"id":35902920,"uuid":"40189739","full_name":"Q42/AndroidScrollingImageView","owner":"Q42","description":"An Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.","archived":false,"fork":false,"pushed_at":"2021-01-29T14:09:56.000Z","size":1591,"stargazers_count":1783,"open_issues_count":14,"forks_count":281,"subscribers_count":50,"default_branch":"master","last_synced_at":"2024-07-31T18:16:51.737Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Q42.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-04T14:31:14.000Z","updated_at":"2024-07-16T06:01:54.000Z","dependencies_parsed_at":"2022-08-26T17:41:27.238Z","dependency_job_id":null,"html_url":"https://github.com/Q42/AndroidScrollingImageView","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2FAndroidScrollingImageView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2FAndroidScrollingImageView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2FAndroidScrollingImageView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Q42%2FAndroidScrollingImageView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Q42","download_url":"https://codeload.github.com/Q42/AndroidScrollingImageView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221417370,"owners_count":16816872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:00:43.930Z","updated_at":"2024-10-25T10:32:01.291Z","avatar_url":"https://github.com/Q42.png","language":"Java","readme":"[![](https://jitpack.io/v/q42/androidscrollingimageview.svg)](https://jitpack.io/#q42/androidscrollingimageview)\n\n# Scrolling Image View\n\nAn Android view for displaying repeated continuous side scrolling images. This can be used to create a parallax animation effect.\n\n## Example\n![Example](https://raw.githubusercontent.com/Q42/AndroidScrollingImageView/master/preview.gif)\n\n## Installation\n*Step 1.* Add the JitPack repository to your project `build.gradle` file\n```gradle\nallprojects {\n    repositories {\n        // ~~~\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n*Step 2.* Add the dependency in the form\n```gradle\ndependencies {\n    implementation 'com.github.Q42:AndroidScrollingImageView:1.3.4'\n}\n```\n\n## Sample app\nPlease see the sample app for some examples\n\n![Sample App](https://raw.githubusercontent.com/Q42/AndroidScrollingImageView/master/sample_app.png)\n\n## Usage\nIn your Android layout file add:\n```xml\n\u003ccom.q42.android.scrollingimageview.ScrollingImageView\n    android:id=\"@+id/scrolling_background\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    scrolling_image_view:speed=\"60dp\"\n    scrolling_image_view:contiguous=\"false\"\n    scrolling_image_view:source=\"@drawable/scrolling_background\" /\u003e\n```\n\nThere are three attributes for the `ScrollingImageView`:\n* `speed` is the number of `dp`'s to move the drawable per second (may be a negative number)\n* `source` is the drawable to paint. May refer to an array of drawables\n* `contiguous` When source is an array of drawables, `contiguous` determines their ordering.\n\n  false (default) for random ordering, true for the same order as in the array\n\nDon't forget to add the namespace to your root XML element\n```xml\nxmlns:scrolling_image_view=\"http://schemas.android.com/apk/res-auto\"\n```\n\nIn your Java code, you can start and stop the animation like this:\n```java\nScrollingImageView scrollingBackground = (ScrollingImageView) loader.findViewById(R.id.scrolling_background);\nscrollingBackground.stop();\nscrollingBackground.start();\n```\n\n## Parallax effect\nIn order to achieve a parallax effect, you can stack multiple `ScrollingImageView`'s in a `FrameLayout` with different speeds. For example:\n```xml\n\u003cFrameLayout\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\u003e\n\n  \u003ccom.q42.android.scrollingimageview.ScrollingImageView\n      android:id=\"@+id/scrolling_background\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"wrap_content\"\n      scrolling_image_view:speed=\"60dp\"\n      scrolling_image_view:source=\"@drawable/scrolling_background\" /\u003e\n      \n  \u003ccom.q42.android.scrollingimageview.ScrollingImageView\n      android:id=\"@+id/scrolling_foreground\"\n      android:layout_width=\"match_parent\"\n      android:layout_height=\"wrap_content\"\n      scrolling_image_view:speed=\"150dp\"\n      scrolling_image_view:source=\"@drawable/scrolling_foreground\" /\u003e\n\u003c/FrameLayout\u003e\n```\n","funding_links":[],"categories":["Index `(light-weight pages)`","Java","滚动效果(Scroll)","Index"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQ42%2FAndroidScrollingImageView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FQ42%2FAndroidScrollingImageView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FQ42%2FAndroidScrollingImageView/lists"}