{"id":16619560,"url":"https://github.com/yanzhenjie/androidwheel","last_synced_at":"2025-08-31T14:36:16.597Z","repository":{"id":57729861,"uuid":"100232890","full_name":"yanzhenjie/AndroidWheel","owner":"yanzhenjie","description":"Android Wheel View. I just fork it and continue to maintain it, this is not my credit, I pay tribute to the predecessors.","archived":false,"fork":false,"pushed_at":"2018-01-29T06:35:25.000Z","size":147,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T11:24:17.694Z","etag":null,"topics":["android-wheel","wheel","wheel-view"],"latest_commit_sha":null,"homepage":"https://github.com/yanzhenjie/AndroidWheel","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/yanzhenjie.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":"2017-08-14T05:53:14.000Z","updated_at":"2020-03-21T18:20:17.000Z","dependencies_parsed_at":"2022-09-01T09:10:32.382Z","dependency_job_id":null,"html_url":"https://github.com/yanzhenjie/AndroidWheel","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/yanzhenjie/AndroidWheel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanzhenjie%2FAndroidWheel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanzhenjie%2FAndroidWheel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanzhenjie%2FAndroidWheel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanzhenjie%2FAndroidWheel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yanzhenjie","download_url":"https://codeload.github.com/yanzhenjie/AndroidWheel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yanzhenjie%2FAndroidWheel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272992377,"owners_count":25027602,"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","status":"online","status_checked_at":"2025-08-31T02:00:09.071Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["android-wheel","wheel","wheel-view"],"created_at":"2024-10-12T02:42:16.359Z","updated_at":"2025-08-31T14:36:16.556Z","avatar_url":"https://github.com/yanzhenjie.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# AndWheel\nAndroid Wheel View, The original project may have stopped maintenance, I want to continue to maintain it, so I just fork it, made a few changes. In any case, this is not my credit. Let us pay tribute to our predecessors.\n\nOriginal address: [https://code.google.com/archive/p/android-wheel](https://code.google.com/archive/p/android-wheel)\n\n## Download\n* Gradle\n```\nimplementation 'com.yanzhenjie:wheel:1.0.0'\n```\n\n* Maven\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.yanzhenjie\u003c/groupId\u003e\n  \u003cartifactId\u003ewheel\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nAndroidWheel requires at minimum Java 7 or Android 2.2(Api level 8) .\n\n## Usage\n1, Initialize View\n```java\nWheelView wheelView = ...;\n```\n\n2, Set the adapter\n```java\nWheelViewAdapter adapter = ...;\nwheelView.setAdapter(adapter);\n```\n\nAdapter is an interface:\n```java\npublic interface WheelViewAdapter {\n    int getItemsCount();\n\n    View getItem(int position, View convertView, ViewGroup parent);\n\n    View getEmptyItem(View convertView, ViewGroup parent);\n\n    void registerDataSetObserver(DataSetObserver observer);\n\n    void unregisterDataSetObserver(DataSetObserver observer);\n}\n```\n\nFor convenience, AndWheel has provided some simple implementations of the adapter internally:\n```java\n1. AbstractWheelAdapter\n2. AbstractWheelTextAdapter\n3. ArrayWheelAdapter\n4. NumericWheelAdapter\n```\n`AbstractWheelTextAdapter` is recommended.\n\n3, Listening to the Item's changes\n```java\nwheelView.addChangingListener(new OnWheelChangedListener() {\n    @Override\n    public void onChanged(WheelView wheel, int oldValue, int newValue) {\n        // TODO what to do.\n    }\n});\n```\nThis oldValue/newValue is the `index` of the wheel's Item.\n\n4, Listen to the Item's clicks\n```java\nwheelView.addClickingListener(new OnWheelClickedListener() {\n    @Override\n    public void onItemClicked(WheelView wheel, int itemIndex) {\n        // TODO what to do.\n    }\n});\n```\n\n## Attached\nThe original project does not change the shadow of the View and middle selector. Now it works.\n\nModify the shadow above and below:\n```java\nint[] colors = new int[](Color.RED, Color.BLUE, Color.GREEN);\n\nGradientDrawable topShadow = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, colors);\nwheelView.setTopShadow(topShadow);\n\nGradientDrawable bottomShadow = new GradientDrawable(GradientDrawable.Orientation.BOTTOM_TOP, colors);\nwheelView.setBottomShadow(bottomShadow);\n```\n\nModify middle selector:\n```java\nDrawable centerFilter = ...;\nwheelView.setCenterFilter(centerFilter);\n```\n\nThis is an example: [https://github.com/yanzhenjie/Years](https://github.com/yanzhenjie/Years)\n\n## ProGuard\nIf you are using ProGuard you might need to add the following options:\n```\n-dontwarn com.yanzhenjie.wheel.**\n```\n\n## License\n```text\nCopyright 2017 Yan Zhenjie\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanzhenjie%2Fandroidwheel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyanzhenjie%2Fandroidwheel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyanzhenjie%2Fandroidwheel/lists"}