{"id":13537500,"url":"https://github.com/Bigkoo/Android-PickerView","last_synced_at":"2025-04-02T04:30:51.922Z","repository":{"id":25129014,"uuid":"28550872","full_name":"Bigkoo/Android-PickerView","owner":"Bigkoo","description":"This is a picker view for android , support linkage effect, timepicker and optionspicker.（时间选择器、省市区三级联动）","archived":false,"fork":false,"pushed_at":"2022-12-30T03:36:03.000Z","size":6389,"stargazers_count":13423,"open_issues_count":436,"forks_count":3443,"subscribers_count":315,"default_branch":"master","last_synced_at":"2024-08-04T00:06:38.902Z","etag":null,"topics":["android-pickerview","datepicker","optionspicker","pickerview","timepicker","wheelview"],"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/Bigkoo.png","metadata":{"files":{"readme":"README-en.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":"2014-12-28T01:46:38.000Z","updated_at":"2024-08-02T11:15:55.000Z","dependencies_parsed_at":"2023-01-14T07:00:50.571Z","dependency_job_id":null,"html_url":"https://github.com/Bigkoo/Android-PickerView","commit_stats":null,"previous_names":["saiwu-bigkoo/android-pickerview"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bigkoo%2FAndroid-PickerView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bigkoo%2FAndroid-PickerView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bigkoo%2FAndroid-PickerView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bigkoo%2FAndroid-PickerView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bigkoo","download_url":"https://codeload.github.com/Bigkoo/Android-PickerView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246756974,"owners_count":20828803,"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":["android-pickerview","datepicker","optionspicker","pickerview","timepicker","wheelview"],"created_at":"2024-08-01T09:00:59.682Z","updated_at":"2025-04-02T04:30:49.475Z","avatar_url":"https://github.com/Bigkoo.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"\n# Android-PickerView\n\n\n\n[![API](https://img.shields.io/badge/API-9%2B-brightgreen.svg)](https://android-arsenal.com/api?level=9) \n[![license](https://img.shields.io/hexpm/l/plug.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\n#### Show some :heart: and :stars: the repo to support the project\n[![GitHub stars](https://img.shields.io/github/stars/Bigkoo/Android-PickerView.svg?style=social)](https://github.com/Bigkoo/Android-PickerView/stargazers) [![GitHub forks](https://img.shields.io/github/forks/Bigkoo/Android-PickerView.svg?style=social)](https://github.com/Bigkoo/Android-PickerView/network) [![GitHub watchers](https://img.shields.io/github/watchers/Bigkoo/Android-PickerView.svg?style=social)](https://github.com/Bigkoo/Android-PickerView/watchers)\n\n#### [中文文档](https://github.com/Bigkoo/Android-PickerView/blob/master/README.md)\n\n## Introduction\n\nThis is a library for android to pick date or options like IOS system WheelView widget.\nand support for the linkage, dialog . It's very easy to use ,  you also can customize layout, which make it very customizable.\n\n\n* there are two options called OptionsPickerView and TimePickerView\n\n* OptionsPickerView supports three levels of linkage\n\n* TimePickerView support selection date range\n\n* support \"year, month, day, hour, minute, second\", \"provincial, city, district\" and other options of the unit (label) show or hide and customize label.\n\n* supports custom text, color, text size, etc.\n\n* If Item text length is too long, it will be adapted to the length of the Item to avoid the problem of incomplete display\n\n\n\n# How to use\n\n\n## 1.Add the dependency：\n\n### Gradle\n\n```java\ncompile 'com.contrarywind:Android-PickerView:4.1.9'\n```\n\n### Maven\n\n```\n\u003cdependency\u003e\n\u003cgroupId\u003ecom.contrarywind\u003c/groupId\u003e\n\u003cartifactId\u003eAndroid-PickerView\u003c/artifactId\u003e\n\u003cversion\u003e4.1.8\u003c/version\u003e\n\u003ctype\u003epom\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## 2.Add the following code in your Activity：\n\n```java\n//TimePicker\n pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() {\n            @Override\n            public void onTimeSelect(Date date,View v) {//Callback\n                tvTime.setText(getTime(date));\n            }\n        })\n             .build();\n pvTime.show();\n```\n\n```java\n//OptionsPicker\n pvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {\n            @Override\n            public void onOptionsSelect(int options1, int option2, int options3 ,View v) {\n                ////Callback\n                String tx = options1Items.get(options1).getPickerViewText()\n                        + options2Items.get(options1).get(option2)\n                        + options3Items.get(options1).get(option2).get(options3).getPickerViewText();\n                tvOptions.setText(tx);\n            }\n        }).build();\n\n //pvOptions.setPicker(options1Items);\n pvOptions.setPicker(options1Items, options2Items);\n //pvOptions.setPicker(options1Items, options2Items, options3Items);\n pvOptions.show();\n```\n## Just so easy ~\n\n\n### Notes（2017-7-10）\n- when we start setting the date, we need to pay special attention.\n\n- reason: the internal component of the Calendar adds 1 processing, which made the month's number of  count reduced one.\n- error usage case:\n\n\u003eStartDate.set (2013,1,1);\n\n\u003eEndDate.set (2020,12,31);\n\n- correct use case:\n\n\u003eStartDate.set (2013,0,1);\n\n\u003eEndDate.set (2020,11,31);\n\u003c/br\u003e\n\n\nIf the default style does not meet your expectations, You can also customize attributes to apply\n\n## Customize Useage：\n```java\n Calendar selectedDate = Calendar.getInstance();\n Calendar startDate = Calendar.getInstance();\n startDate.set(2013,0,1);\n Calendar endDate = Calendar.getInstance();\n endDate.set(2020,11,1);\n\n pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() {\n            @Override\n            public void onTimeSelect(Date date,View v) {//callback\n                tvTime.setText(getTime(date));\n            }\n        })\n                .setType(new boolean[]{false, false, false, true, true, false})// type of date \n                .setCancelText(\"Cancel\")\n                .setSubmitText(\"Sure\")\n                .setContentSize(18)\n                .setTitleSize(20)\n                .setTitleText(\"Title\")\n                .setOutSideCancelable(false)// default is true\n                .isCyclic(true)// default is false\n                .setTitleColor(Color.BLACK)\n                .setSubmitColor(Color.BLUE)\n                .setCancelColor(Color.BLUE)\n                .setTitleBgColor(0xFF666666)//night mode\n                .setBgColor(0xFF333333)//night mode\n                .setRangDate(startDate,endDate)\n                .setLabel(\"year\",\"month\",\"day\",\"hours\",\"mins\",\"seconds\")\n                .build();\n```\n\n```java\npvOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {\n            @Override\n            public void onOptionsSelect(int options1, int option2, int options3 ,View v) {\n                ////Callback\n                String tx = options1Items.get(options1).getPickerViewText()\n                        + options2Items.get(options1).get(option2)\n                        + options3Items.get(options1).get(option2).get(options3).getPickerViewText();\n                tvOptions.setText(tx);\n            }\n        })\n                .setSubmitText(\"sure\")\n                .setCancelText(\"cancel\")\n                .setTitleText(\"title\")\n                .setSubCalSize(18)\n                .setTitleSize(20)\n                .setTitleColor(Color.BLACK)\n                .setSubmitColor(Color.BLUE)\n                .setCancelColor(Color.BLUE)\n                .setTitleBgColor(0xFF666666)//night mode\n                .setBgColor(0xFF444444)//night mode\n                .setContentTextSize(18)\n                .setLinkage(false)\n                .isCenterLabel(false) //default is true , if you choose false , the label text will add to all item ContentText right\n                .setLabels(\"province\", \"city\", \"district\")\n                .setCyclic(false, false, false)\n                .setSelectOptions(0, 0, 0)  //default options\n                .setOutSideCancelable(false)//dismiss， default is true\n                .isRestoreItem(true)// restore option with first item when select changed。\n                .build();\n\n        pvOptions.setPicker(options1Items, options2Items, options3Items);\n```\n## Customize Layout：\n```java\n  private void initCustomTimePicker() {\n        // be careful：In the custom layout， the layout of the ID for optionspicker\n        // or TimePicker and its child widget must not be modified,\n        // otherwise  will be reported NullPointerException\n        // For more details， Please refer to the two custom layouts in demo\n\n        Calendar selectedDate = Calendar.getInstance();//System current time\n        Calendar startDate = Calendar.getInstance();\n        startDate.set(2013,1,23);\n        Calendar endDate = Calendar.getInstance();\n        endDate.set(2019,2,28);\n\n        pvCustomTime = new TimePickerBuilder(this, new OnTimeSelectListener() {\n            @Override\n            public void onTimeSelect(Date date, View v) {//call back\n                btn_CustomTime.setText(getTime(date));\n            }\n        })       .setType(new boolean[]{true, true, true, false, false, false})// year - month - day\n                .setDate(selectedDate)\n                .setRangDate(startDate,endDate)\n                .setLayoutRes(R.layout.pickerview_custom_time, new CustomListener() {\n\n                    @Override\n                    public void customLayout(View v) {\n                        final TextView tvSubmit = (TextView) v.findViewById(R.id.tv_finish);\n                        ImageView ivCancel = (ImageView) v.findViewById(R.id.iv_cancel);\n                        tvSubmit.setOnClickListener(new View.OnClickListener() {\n                            @Override\n                            public void onClick(View v) {\n                                pvCustomTime.returnData(tvSubmit);\n                            }\n                        });\n                        ivCancel.setOnClickListener(new View.OnClickListener() {\n                            @Override\n                            public void onClick(View v) {\n                                pvCustomTime.dismiss();\n                            }\n                        });\n                    }\n                })\n                .setDividerColor(Color.BLACK)\n                .build();\n\n    }\n```\n\n## If you need to set the non-linkage data：\n\n```java\npvNoLinkOptions = new OptionsPickerBuilder(this, new OnOptionsSelectListener() {\n\n            @Override\n            public void onOptionsSelect(int options1, int options2, int options3, View v) {\n\n                String str = \"food:\"+food.get(options1)\n                        +\"\\nclothes:\"+clothes.get(options2)\n                        +\"\\ncomputer:\"+computer.get(options3);\n\n                Toast.makeText(MainActivity.this,str,Toast.LENGTH_SHORT).show();\n            }\n        }).build();\n        pvNoLinkOptions.setNPicker(food,clothes,computer);\n        pvNoLinkOptions.show();\n```\n\n## For more detail, please refer to the Demo code, If there is still doubt about you, please [New Issue](https://github.com/Bigkoo/Android-PickerView/issues) \n\n###  [Here is demo code](https://github.com/Bigkoo/Android-PickerView/blob/master/app/src/main/java/com/bigkoo/pickerviewdemo/MainActivity.java)\n\n###  [Methods-and-parameters](https://github.com/Bigkoo/Android-PickerView/wiki/Methods-and-parameters)\n\n\n## Thanks\n\n- [WheelView](https://github.com/venshine/WheelView)\n- [androidWheelView](https://github.com/weidongjian/androidWheelView/)\n\n# License\n\n```\nCopyright 2014 Bigkoo\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```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBigkoo%2FAndroid-PickerView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBigkoo%2FAndroid-PickerView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBigkoo%2FAndroid-PickerView/lists"}