Giter Club home page Giter Club logo

android-pickerview's Introduction

##(原作者saiwu-bigkoo吴哥已经转行了,他已把项目转交给我维护,所以我会继续更新优化,不能白白荒废了,欢迎Pull Request,提issue。有兴趣的小伙伴可以加入QQ群:387051294 讨论交流)

介绍

一款仿iOS的PickerView控件,有时间选择和选项选择,并支持一二三级联动,支持自定义样式

  • 有时间和选项这两种选择器
  • 选项选择器支持三级联动
  • 时间选择器支持选择年份范围
  • 支持“年,月,日,时,分,秒”,“省,市,区”等选项的单位(label)显示、隐藏和自定义。
  • 支持自定义文字、颜色、文字大小等属性
  • 支持背景颜色更换,有夜间模式需求的问题可以解决了
  • Item的文字长度过长时,文字会自适应缩放到Item的长度,避免显示不完全的问题

——TimePickerView 时间选择器,支持年月日时分,年月日,年月,时分等格式
——OptionsPickerView 选项选择器,支持一,二,三级选项选择,并且可以设置是否联动

TimePicker.gif OptionsPicker.gif

说明文档 Documentation(还在持续更新中)

V3.0.5版本更新说明(2017-2-28)

  • 优化:数据源由ArrayList 改为List 类型
  • 优化:在时间选择器中,隐藏单位标签的情况下,修复滚轮偏左的问题。
  • 修复:lib去除 v7 compat包 依赖,解决某些情况下support包冲突问题。

历史版本更新说明请查看Wiki

How to use

Gradle

compile 'com.contrarywind:Android-PickerView:3.0.5'
//compile 'com.bigkoo:pickerview:lunar.1.0'  Lunar Branch 农历分支

OR

Maven

<dependency> 
<groupId>com.contrarywind</groupId> 
<artifactId>Android-PickerView</artifactId>
<version>3.0.5</version>
<type>pom</type>
</dependency>

Sample usage:

//TimePicker
 pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date,View v) {//选中事件回调
                tvTime.setText(getTime(date));
            }
        })
             .build();
 pvTime.show();


//OptionsPicker
 pvOptions = new  OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3 ,View v) {
                //返回的分别是三个级别的选中位置
                String tx = options1Items.get(options1).getPickerViewText()
                        + options2Items.get(options1).get(option2)
                        + options3Items.get(options1).get(option2).get(options3).getPickerViewText();
                tvOptions.setText(tx);
            }
        }).build();
 pvOptions.setPicker(options1Items, options2Items, options3Items);
 pvOptions.show(); 

详细使用请参考这里

效果图(招行信用卡的“掌上生活”里面条件选择器他们用的就是我这个库,大家可以当实际项目参考)

Thanks

android-pickerview's People

Contributors

saiwu-bigkoo avatar xiaosong520 avatar greatgarlic avatar totcw avatar keluokeda avatar xxjy avatar

Watchers

James Cloos avatar Fish avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.