{"id":13644674,"url":"https://github.com/sayyam/carouselview","last_synced_at":"2025-04-21T10:34:02.825Z","repository":{"id":50331885,"uuid":"53938675","full_name":"sayyam/carouselview","owner":"sayyam","description":"A simple library to add carousel view in android app.","archived":false,"fork":false,"pushed_at":"2020-02-18T12:24:46.000Z","size":9514,"stargazers_count":1167,"open_issues_count":75,"forks_count":262,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-12T10:41:45.950Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sayyam.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":"2016-03-15T11:22:18.000Z","updated_at":"2025-04-11T10:01:06.000Z","dependencies_parsed_at":"2022-09-24T23:42:36.043Z","dependency_job_id":null,"html_url":"https://github.com/sayyam/carouselview","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayyam%2Fcarouselview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayyam%2Fcarouselview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayyam%2Fcarouselview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sayyam%2Fcarouselview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sayyam","download_url":"https://codeload.github.com/sayyam/carouselview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250040623,"owners_count":21365140,"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-08-02T01:02:10.565Z","updated_at":"2025-04-21T10:33:57.808Z","avatar_url":"https://github.com/sayyam.png","language":"Java","readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"/sample/src/main/assets/carousel_baner.jpg\"\u003e\u003c/p\u003e\n\nCarouselView\n=======\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-CarouselView-green.svg?style=true)](https://android-arsenal.com/details/1/3289)\n\nA simple yet flexible library to add carousel view in your android application.\n\n\n\u003cimg src=\"/sample/src/main/assets/carousel_gif.gif\" title=\"sample\" width=\"500\" height=\"460\" /\u003e\n\n\nDownload\n--------\n### Gradle:\n```groovy\ncompile 'com.synnapps:carouselview:0.1.5'\n```\n### Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.synnapps\u003c/groupId\u003e\n  \u003cartifactId\u003ecarouselview\u003c/artifactId\u003e\n  \u003cversion\u003e0.1.5\u003c/version\u003e\n  \u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\nUsage\n--------\n\n### Include following code in your layout:\n\n```xml\n    \u003ccom.synnapps.carouselview.CarouselView\n        android:id=\"@+id/carouselView\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"200dp\"\n        app:fillColor=\"#FFFFFFFF\"\n        app:pageColor=\"#00000000\"\n        app:radius=\"6dp\"\n        app:slideInterval=\"3000\"\n        app:strokeColor=\"#FF777777\"\n        app:strokeWidth=\"1dp\"/\u003e\n```\n### Include following code in your activity:\n```java\npublic class SampleCarouselViewActivity extends AppCompatActivity {\n\n    CarouselView carouselView;\n\n    int[] sampleImages = {R.drawable.image_1, R.drawable.image_2, R.drawable.image_3, R.drawable.image_4, R.drawable.image_5};\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_sample_carousel_view);\n\n        carouselView = (CarouselView) findViewById(R.id.carouselView);\n        carouselView.setPageCount(sampleImages.length);\n\n        carouselView.setImageListener(imageListener);\n    }\n\n    ImageListener imageListener = new ImageListener() {\n        @Override\n        public void setImageForPosition(int position, ImageView imageView) {\n            imageView.setImageResource(sampleImages[position]);\n        }\n    };\n\n}\n```\n\n### If you want to add custom view, implement ```ViewListener```.\n```java\n\npublic class SampleCarouselViewActivity extends AppCompatActivity {\n\n    CarouselView customCarouselView;\n    int NUMBER_OF_PAGES = 5;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_sample_carousel_view);\n\n        customCarouselView = (CarouselView) findViewById(R.id.customCarouselView);\n        customCarouselView.setPageCount(NUMBER_OF_PAGES);\n        // set ViewListener for custom view \n        customCarouselView.setViewListener(viewListener);\n    }\n\n    ViewListener viewListener = new ViewListener() {\n    \n        @Override\n        public View setViewForPosition(int position) {\n            View customView = getLayoutInflater().inflate(R.layout.view_custom, null);\n            //set view attributes here\n            \n            return customView;\n        }\n    };\n\n```\n\n### If you'd like to receive touch events for each image\n\n```java\ncustomCarouselView.setImageClickListener(new ImageClickListener() {\n            @Override\n            public void onClick(int position) {\n                Toast.makeText(SampleCarouselViewActivity.this, \"Clicked item: \"+ position, Toast.LENGTH_SHORT).show();\n            }\n        });\n```\n\n### If using ProGuard add this line to your proguard-rules.pro:\n\n```\n-keep class com.synnapps.carouselview.** { *; }\n```\n\n### Supported xml Attributes\n\n| Attribute          \t                    | Description          \t\t\t\t\t\t\t   \t\t\t  \t\t | Values \t\t\t\t        |\n| ------------------------------------------|--------------------------------------------------------------------|------------------------------|\n| app:slideInterval \t                    | Interval per page in ms.           \t\t\t   \t\t      \t\t | integer\t\t\t\t        |\n| app:indicatorGravity                      | Gravity of the indicator.  (Just like layout_gravity) \t\t\t | gravity                      |\n| app:indicatorOrientation                  | Orientation of the indicator. \t\t\t\t\t   \t\t\t  \t | [horizontal, vertical]       |\n| app:indicatorVisibility \t\t\t\t                    | Set visibility of indicator. \t\t | [visible,invisible,gone] \t\t\t\t        |\n| app:fillColor\t  \t\t                    | Color of the filled circle that represents the current page. \t\t | color \t\t\t\t        |\n| app:pageColor   \t\t                    | Color of the filled circles that represents pages. \t\t  \t\t | color \t\t\t\t        |\n| app:radius \t\t\t                    | Radius of the circles. This is also the spacing between circles.   | dimension \t\t\t        |\n| app:snap \t\t\t\t                    | Whether or not the selected indicator snaps to the circles. \t\t | boolean \t\t\t\t        |\n| app:strokeColor \t\t                    | Width of the stroke used to draw the circles. \t\t\t\t\t | color \t\t\t\t        |\n| app:autoPlay                              | Whether or not to auto play. Default: true                         | boolean                      |\n| app:disableAutoPlayOnUserInteraction      | Disables autoPlay when user interacts. Default: false              | boolean                      |\n| app:indicatorMarginHorizontal \t\t\t| Sets horizontal margin for Indicator in Carousel View              | dimension \t\t\t        |\n| app:indicatorMarginVertical \t\t\t    | Sets vertical margin for Indicator in Carousel View                | dimension \t\t\t        |\n| app:pageTransformInterval                 | Sets speed at which page will slide from one to another in ms.     | integer                      |\n| app:pageTransformer                       | Sets page transition animation.                                    | [zoom,flow,depth,slide_over] |\n| app:animateOnBoundary                     | Sets whether to animate from last page. Default: true              | boolean                      |\n\n_Note:_ Add ```xmlns:app=\"http://schemas.android.com/apk/res-auto\"``` in your layout's root view.\n\n\nDeveloped By\n--------\n- Sayyam Mehmood\n- Muhammad Rehan\n\nSpecial Thanks\n--------\n\nThis library uses code snippet from Jake Wharton's [ViewPagerIndicator](https://github.com/JakeWharton/ViewPagerIndicator) to display page indicator.\n\nLicense\n--------\n\n    Copyright 2016 Sayyam.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and \n    limitations under the License.\n","funding_links":[],"categories":["轮播图"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayyam%2Fcarouselview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsayyam%2Fcarouselview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsayyam%2Fcarouselview/lists"}