This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)

Overview

Android-PickerView

API License Download

GitHub stars GitHub forks GitHub watchers

English Document

注意事项、详请使用方式、更新日志等,请查看 Wiki文档

Wiki文档,Wiki文档,Wiki文档 !~ 重要的事情说三遍

对于使用上有任何疑问或优化建议等,欢迎加入QQ群讨论交流技术问题。

交流群1: 387051294(推荐)

交流群2: 219962328(已满)

介绍

这是一款仿iOS的PickerView控件,有时间选择器和选项选择器,新版本的详细特性如下:

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

  • 支持三级联动
  • 设置是否联动
  • 设置循环模式
  • 支持自定义布局。
  • 支持item的分隔线设置。
  • 支持item间距设置。
  • 时间选择器支持起始和终止日期设定。
  • 支持“年,月,日,时,分,秒”,“省,市,区”等选项的单位(label)显示、隐藏和自定义。
  • 支持自定义文字、颜色、文字大小等属性
  • Item的文字长度过长时,文字会自适应缩放到Item的长度,避免显示不完全的问题
  • 支持Dialog 模式。
  • 支持自定义设置容器。
  • 实时回调。

TimePicker.gif TimePickerNight.gif lunar.gif XOffset.png Province.gif CustomLayout.gif

有兴趣研究3D滚轮效果的实现机制,希望把源码研究透彻的可以看看这篇博客:

Android-PickerView系列之源码解析篇(二)

使用注意事项

  • 注意:当我们进行设置时间的启始位置时,需要特别注意月份的设定
  • 原因:Calendar组件内部的月份,是从0开始的,即0-11代表1-12月份
  • 错误使用案例: startDate.set(2013,1,1);  endDate.set(2020,12,1);
  • 正确使用案例: startDate.set(2013,0,1);  endDate.set(2020,11,1);

V4.1.9 版本更新说明(2019-10-20)

  • 修复: 农历 day 偶现越界的问题。
  • 优化: 显示布局中英文默认大写问题。
  • 新增: 最大可见项的数目提供API给开发者设置。(setItemVisibleCount())
  • 新增: 滚轮从中间到两边透明度渐变,提供开关API设置。(isAlphaGradient(true))
  • 新增: 选中项圆形分割线样式。(DividerType.CIRCLE)

V4.1.8 版本更新说明(2019-4-24)

  • 更新gradle版本, wheelview基础库由 compile 改为 api 依赖,避免gradle 5.0+版本无法引入。
  • 修复 setTextXOffset 赋值问题。

V4.1.7 版本更新说明(2019-1-10)

  • 修复 WheelView在初始化时,数据为空导致height=0,造成一直显示不出来的问题。
  • 新增取消按钮的点击事件监听入口。
  • 参数注解添加,规范数据类型。
  • 废弃setBackgroundId方法, 更新方法命名为 setOutSideColor。

更多历史版本详情,请查阅:更新日志(4.x版本)

方法名与参数请查阅:方法名与参数说明文档


如何使用:

Android-PickerView 库使用示例:

1.添加Jcenter仓库 Gradle依赖:

compile 'com.contrarywind:Android-PickerView:4.1.9'

或者

Maven

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

2.在项目中添加如下代码:

//时间选择器
TimePickerView pvTime = new TimePickerBuilder(MainActivity.this, new OnTimeSelectListener() {
                           @Override
                           public void onTimeSelect(Date date, View v) {
                               Toast.makeText(MainActivity.this, getTime(date), Toast.LENGTH_SHORT).show();
                           }
                       }).build();
//条件选择器
 OptionsPickerView pvOptions = new OptionsPickerBuilder(MainActivity.this, new 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(); 

大功告成~

3.如果默认样式不符合你的口味,可以自定义各种属性:

 Calendar selectedDate = Calendar.getInstance();
 Calendar startDate = Calendar.getInstance();
 //startDate.set(2013,1,1);
 Calendar endDate = Calendar.getInstance();
 //endDate.set(2020,1,1);
 
  //正确设置方式 原因:注意事项有说明
  startDate.set(2013,0,1);
  endDate.set(2020,11,31);

 pvTime = new TimePickerBuilder(this, new OnTimeSelectListener() {
            @Override
            public void onTimeSelect(Date date,View v) {//选中事件回调
                tvTime.setText(getTime(date));
            }
        })
                .setType(new boolean[]{true, true, true, true, true, true})// 默认全部显示
                .setCancelText("Cancel")//取消按钮文字
                .setSubmitText("Sure")//确认按钮文字
                .setContentSize(18)//滚轮文字大小
                .setTitleSize(20)//标题文字大小
                .setTitleText("Title")//标题文字
                .setOutSideCancelable(false)//点击屏幕,点在控件外部范围时,是否取消显示
                .isCyclic(true)//是否循环滚动
                .setTitleColor(Color.BLACK)//标题文字颜色
                .setSubmitColor(Color.BLUE)//确定按钮文字颜色
                .setCancelColor(Color.BLUE)//取消按钮文字颜色
                .setTitleBgColor(0xFF666666)//标题背景颜色 Night mode
                .setBgColor(0xFF333333)//滚轮背景颜色 Night mode
                .setDate(selectedDate)// 如果不设置的话,默认是系统时间*/
                .setRangDate(startDate,endDate)//起始终止年月日设定
                .setLabel("","","","","","")//默认设置为年月日时分秒
                .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
                .isDialog(true)//是否显示为对话框样式
                .build();
pvOptions = new  OptionsPickerBuilder(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);
            }
        }) .setOptionsSelectChangeListener(new OnOptionsSelectChangeListener() {
                              @Override
                              public void onOptionsSelectChanged(int options1, int options2, int options3) {
                                  String str = "options1: " + options1 + "\noptions2: " + options2 + "\noptions3: " + options3;
                                  Toast.makeText(MainActivity.this, str, Toast.LENGTH_SHORT).show();
                              }
                          })
                .setSubmitText("确定")//确定按钮文字
                .setCancelText("取消")//取消按钮文字
                .setTitleText("城市选择")//标题
                .setSubCalSize(18)//确定和取消文字大小
                .setTitleSize(20)//标题文字大小
                .setTitleColor(Color.BLACK)//标题文字颜色
                .setSubmitColor(Color.BLUE)//确定按钮文字颜色
                .setCancelColor(Color.BLUE)//取消按钮文字颜色
                .setTitleBgColor(0xFF333333)//标题背景颜色 Night mode
                .setBgColor(0xFF000000)//滚轮背景颜色 Night mode
                .setContentTextSize(18)//滚轮文字大小
                .setLinkage(false)//设置是否联动,默认true
                .setLabels("", "", "")//设置选择的三级单位
                .isCenterLabel(false) //是否只显示中间选中项的label文字,false则每项item全部都带有label。
                .setCyclic(false, false, false)//循环与否
                .setSelectOptions(1, 1, 1)  //设置默认选中项
                .setOutSideCancelable(false)//点击外部dismiss default true
                .isDialog(true)//是否显示为对话框样式
                .isRestoreItem(true)//切换时是否还原,设置默认选中第一项。
                .build();

        pvOptions.setPicker(options1Items, options2Items, options3Items);//添加数据源

4.如果需要自定义布局:

        // 注意:自定义布局中,id为 optionspicker 或者 timepicker 的布局以及其子控件必须要有,否则会报空指针
        // 具体可参考demo 里面的两个自定义布局
        pvCustomOptions = new OptionsPickerBuilder(this, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int option2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = cardItem.get(options1).getPickerViewText();
                btn_CustomOptions.setText(tx);
            }
        })
                .setLayoutRes(R.layout.pickerview_custom_options, new CustomListener() {
                    @Override
                    public void customLayout(View v) {
                        //自定义布局中的控件初始化及事件处理
                        final TextView tvSubmit = (TextView) v.findViewById(R.id.tv_finish);
                        final TextView tvAdd = (TextView) v.findViewById(R.id.tv_add);
                        ImageView ivCancel = (ImageView) v.findViewById(R.id.iv_cancel);
                        tvSubmit.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                pvCustomOptions.returnData(tvSubmit);
                            }
                        });
                        ivCancel.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                pvCustomOptions.dismiss();
                            }
                        });

                        tvAdd.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                getData();
                                pvCustomOptions.setPicker(cardItem);
                            }
                        });

                    }
                })
                .build();
        pvCustomOptions.setPicker(cardItem);//添加数据

5.对使用还有疑问的话,可参考demo代码

请戳我查看demo代码

6.若只需要WheelView基础控件自行扩展实现逻辑,可直接添加基础控件库,Gradle 依赖:

compile 'com.contrarywind:wheelview:4.1.0'

WheelView 使用代码示例:

xml布局:

 <com.contrarywind.view.WheelView
            android:id="@+id/wheelview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

Java 代码:

WheelView wheelView = findViewById(R.id.wheelview);

        wheelView.setCyclic(false);

        final List<String> mOptionsItems = new ArrayList<>();
        mOptionsItems.add("item0");
        mOptionsItems.add("item1");
        mOptionsItems.add("item2");
  
        wheelView.setAdapter(new ArrayWheelAdapter(mOptionsItems));
        wheelView.setOnItemSelectedListener(new OnItemSelectedListener() {
            @Override
            public void onItemSelected(int index) {
                Toast.makeText(MainActivity.this, "" + mOptionsItems.get(index), Toast.LENGTH_SHORT).show();
            }
        });

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

Thanks

License

Copyright 2014 Bigkoo
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Problem with datas

    Problem with datas

    Hello, first, i m sorry i don't speak chinese. I want to know if i can adapt the list at runtime for exemple:

    • wheel A contains A1,A2,A3
    • wheel B contains B1A1,B2A1, B1A2,B2A2, B1A3,B2A3, So if A1 if selected B1A1 and B2A1 is showing, A2 B1A2 and B2A2, etc , ...
      Thanks a lot

    我试图用中文来传播 你好,首先,我很抱歉,我不会说中文。 我想知道我是否可以在运行时调整列表,例如: 轮A包含A1,A2,A3 轮B包含B1A1,B2A1, B1A2,B2A2, B1A3,B2A3, 所以如果A1如果选择B1A1和B2A1显示,A2 B1A2和B2A2等...

    opened by helsephas 11
  • 选择最后或者第一个的时候滚轮会一直抖动(2.0.6)

    选择最后或者第一个的时候滚轮会一直抖动(2.0.6)

    *在选择最后一个Item的时候,滚轮一直抖动。这个不管是demo还是我自己自定义的都会这样。 *然后另外一个问题,我自己根据时间选择器改造的一个demo,当月份只有3个item的时候,第一个会选不到,然后会一直抖动,选不到的我现在不知道是我的代码问题还是库的问题。

    *原谅渣渣的我直接用百度网盘分享录屏给你:{http://pan.baidu.com/s/1qWRbGLm}

    opened by wb-hwang 8
  • 问下控件开发环境是什么样的

    问下控件开发环境是什么样的

    下面3个任务通不过 image 错误提示如下

    下午3:41:11: Executing external task 'javadoc'...
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelOptions.java:7: 错误: 找不到符号
    import com.bigkoo.pickerview.R;
                                ^
      符号:   类 R
      位置: 程序包 com.bigkoo.pickerview
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:25: 错误: 找不到符号
    import com.bigkoo.pickerview.R;
                                ^
      符号:   类 R
      位置: 程序包 com.bigkoo.pickerview
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:8: 错误: 找不到符号
    import com.bigkoo.pickerview.R;
                                ^
      符号:   类 R
      位置: 程序包 com.bigkoo.pickerview
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/DensityUtil.java:11: 警告: context没有 @param
        public static int dip2px(Context context, float dpValue) {
                          ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/DensityUtil.java:11: 警告: dpValue没有 @param
        public static int dip2px(Context context, float dpValue) {
                          ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/DensityUtil.java:11: 警告: 没有 @return
        public static int dip2px(Context context, float dpValue) {
                          ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/DensityUtil.java:20: 警告: context没有 @param
        public static int px2dip(Context context, float pxValue) {
                          ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/DensityUtil.java:20: 警告: pxValue没有 @param
        public static int px2dip(Context context, float pxValue) {
                          ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/DensityUtil.java:20: 警告: 没有 @return
        public static int px2dip(Context context, float pxValue) {
                          ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/OnWheelChangedListener.java:6: 错误: 此处不允许使用标记: <li>
     * <li> New Wheel position is set
       ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/OnWheelChangedListener.java:7: 错误: 此处不允许使用标记: <li>
     * <li> Wheel view is scrolled
       ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelOptions.java:124: 警告: @param 没有说明
         * @param label1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelOptions.java:125: 警告: @param 没有说明
         * @param label2
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelOptions.java:126: 警告: @param 没有说明
         * @param label3
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelOptions.java:140: 警告: @param 没有说明
         * @param cyclic
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelOptions.java:151: 警告: @return 没有说明
         * @return
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:69: 错误: 未知标记: Description
         * @Description: TODO 弹出日期时间选择器
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:71: 警告: year没有 @param
        public void setPicker(int year ,int month ,int day,int h,int m) {
                    ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:71: 警告: month没有 @param
        public void setPicker(int year ,int month ,int day,int h,int m) {
                    ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:71: 警告: day没有 @param
        public void setPicker(int year ,int month ,int day,int h,int m) {
                    ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:71: 警告: h没有 @param
        public void setPicker(int year ,int month ,int day,int h,int m) {
                    ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:71: 警告: m没有 @param
        public void setPicker(int year ,int month ,int day,int h,int m) {
                    ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelTime.java:223: 警告: @param 没有说明
         * @param cyclic
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:161: 警告: context没有 @param
        public WheelView(Context context) {
               ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:153: 警告: context没有 @param
        public WheelView(Context context, AttributeSet attrs) {
               ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:153: 警告: attrs没有 @param
        public WheelView(Context context, AttributeSet attrs) {
               ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:145: 警告: context没有 @param
        public WheelView(Context context, AttributeSet attrs, int defStyle) {
               ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:145: 警告: attrs没有 @param
        public WheelView(Context context, AttributeSet attrs, int defStyle) {
               ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/lib/WheelView.java:145: 警告: defStyle没有 @param
        public WheelView(Context context, AttributeSet attrs, int defStyle) {
               ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:74: 警告: @param 没有说明
         * @param option1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:81: 警告: @param 没有说明
         * @param option1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:82: 警告: @param 没有说明
         * @param option2
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:89: 警告: @param 没有说明
         * @param option1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:90: 警告: @param 没有说明
         * @param option2
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:91: 警告: @param 没有说明
         * @param option3
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:98: 警告: @param 没有说明
         * @param label1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:105: 警告: @param 没有说明
         * @param label1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:106: 警告: @param 没有说明
         * @param label2
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:113: 警告: @param 没有说明
         * @param label1
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:114: 警告: @param 没有说明
         * @param label2
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:115: 警告: @param 没有说明
         * @param label3
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/OptionsPopupWindow.java:122: 警告: @param 没有说明
         * @param cyclic
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:77: 警告: @param 没有说明
         * @param START_YEAR
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:78: 警告: @param 没有说明
         * @param END_YEAR
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:87: 警告: @param 没有说明
         * @param date
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:106: 警告: @param 没有说明
         * @param parent
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:107: 警告: @param 没有说明
         * @param gravity
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:108: 警告: @param 没有说明
         * @param x
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:109: 警告: @param 没有说明
         * @param y
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:110: 警告: @param 没有说明
         * @param date
           ^
    /Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/src/main/java/com/bigkoo/pickerview/TimePopupWindow.java:131: 警告: @param 没有说明
         * @param cyclic
           ^
    :pickerview:javadoc
    3 个错误
    48 个警告
    :pickerview:javadoc FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':pickerview:javadoc'.
    > Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/xuhuan/AndroidStudioProjects/Android-PickerView-master/pickerview/build/tmp/javadoc/javadoc.options'
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    
    Total time: 7.445 secs
    Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/javadoc'' finished with non-zero exit value 1
    下午3:41:19: External task execution finished 'javadoc'.
    
    opened by xuhuan 8
  • 时间范围限制不支持时分秒  要是能加上就好了

    时间范围限制不支持时分秒 要是能加上就好了

    Class:WheelTime public void setRangDate(Calendar startDate, Calendar endDate) {

        if (startDate == null && endDate != null) {
            int year = endDate.get(Calendar.YEAR);
            int month = endDate.get(Calendar.MONTH) + 1;
            int day = endDate.get(Calendar.DAY_OF_MONTH);
            if (year > startYear) {
                this.endYear = year;
                this.endMonth = month;
                this.endDay = day;
            } else if (year == startYear) {
                if (month > startMonth) {
                    this.endYear = year;
                    this.endMonth = month;
                    this.endDay = day;
                } else if (month == startMonth) {
                    if (day > startDay) {
                        this.endYear = year;
                        this.endMonth = month;
                        this.endDay = day;
                    }
                }
            }
    
        } else if (startDate != null && endDate == null) {
            int year = startDate.get(Calendar.YEAR);
            int month = startDate.get(Calendar.MONTH) + 1;
            int day = startDate.get(Calendar.DAY_OF_MONTH);
            if (year < endYear) {
                this.startMonth = month;
                this.startDay = day;
                this.startYear = year;
            } else if (year == endYear) {
                if (month < endMonth) {
                    this.startMonth = month;
                    this.startDay = day;
                    this.startYear = year;
                } else if (month == endMonth) {
                    if (day < endDay) {
                        this.startMonth = month;
                        this.startDay = day;
                        this.startYear = year;
                    }
                }
            }
    
        } else if (startDate != null && endDate != null) {
            this.startYear = startDate.get(Calendar.YEAR);
            this.endYear = endDate.get(Calendar.YEAR);
            this.startMonth = startDate.get(Calendar.MONTH) + 1;
            this.endMonth = endDate.get(Calendar.MONTH) + 1;
            this.startDay = startDate.get(Calendar.DAY_OF_MONTH);
            this.endDay = endDate.get(Calendar.DAY_OF_MONTH);
    
    
        }
    
    
    }
    
    opened by hy20160705 7
  • 运行TimePickView出现空指针异常

    运行TimePickView出现空指针异常

    java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout.setBackgroundColor(int)' on a null object reference

    opened by bozaixing 7
  • 运行就会报错

    运行就会报错

    Error:(252, 61) 错误: 找不到符号 符号: 类 Builder 位置: 类 OptionsPickerView Error:(252, 124) 错误: <匿名>不是抽象的, 并且未覆盖OnOptionsSelectListener中的抽象方法onOptionsSelect(int,int,int) Error:(253, 13) 错误: 方法不会覆盖或实现超类型的方法

    代码如下 //条件选择器 OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() { @Override public void onOptionsSelect(int options1, int option2, int options3 ,View v) { //返回的分别是三个级别的选中位置 String tx = num1.get(options1); } }).build(); pvOptions.setPicker(num1);

    opened by JayZhaoBoy 7
  • Kotlin泛型报错解决

    Kotlin泛型报错解决

    修改OptionsPickerBuilder的build方法为:

     public <T> OptionsPickerView<T> build() {
            return new OptionsPickerView<T>(mPickerOptions);
        }
    

    修改后即可解决

    enhancement 
    opened by appdev 6
  • 不能二级不联动吗

    不能二级不联动吗

    `` pvNoLinkOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {

            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
    
                String str = "food:" + food.get(options1)
                        + "\nclothes:" + clothes.get(options2)
                        + "\ncomputer:" + computer.get(options3);
    
                Toast.makeText(MainActivity.this, str, Toast.LENGTH_SHORT).show();
            }
        }).build();
        pvNoLinkOptions.setPicker(food, clothes);
    
    opened by 643063150 6
  • item start position

    item start position

    OptionsPickerView keeps last scroll, even they scroll but hide it instead of select, position for next showing. How to prevent it? I want OPV always start at picked position. How to do that? I find in the source code but didnt found anything.

    opened by kainjinez 6
  • 文字被压扁了点

    文字被压扁了点

    1、.setContentTextSize(20)//滚轮文字大小 .setLineSpacingMultiplier(2.0f)//设置两横线之间的间隔倍数 按上面设置跟iOS对比了下,能看出来文字被压扁了点,看了下源码计算高度的部分不是很懂。 2、OptionsPickerView 只有一级时,.setSelectOptions(selectedPosition) 设置了1但是还是选中第0项。

    opened by wpq2014 6
  • fix the bug that PickView disappears

    fix the bug that PickView disappears

    Desc: If we use custom layout , and in this PickView we click it's child views or areas which don't consume touch events,the following will occur.

    • If PickView shows as a dialog, PickView will disappear directly, even if setOutSideCancelable() is true or false
    • If not show as a dialog and setOutSideCancelable() is true, PickView still disappears

    You can easily reproduce the situation in your sample app just by adding the follwing code to MainActivity#initCustomTimePicker(), run app and once you click the top middle area of the PickView (this area doesn't consume any touch events), you will find this PickView disappeared .isDialog(true) .setOutSideCancelable(false) .build();

    opened by Ficat 0
  • 布局与底部导航栏重叠的问题

    布局与底部导航栏重叠的问题

    自问自答 build()之前调用setDecorView即可 activity中如下

    .setDecorView(activity.getWindow().getDecorView().findViewById(android.R.id.content))
                    .build();
    

    Frament中类似 下面是demo中的例子:

     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
            mView = inflater.inflate(R.layout.fragment_test, null);
            return mView;
        }
    
    
        @Override
        public void onActivityCreated(@Nullable Bundle savedInstanceState) {
            super.onActivityCreated(savedInstanceState);
            mFrameLayout = (FrameLayout) mView.findViewById(R.id.fragmen_fragment);
        }
    
     .setDecorView(mFrameLayout)//非dialog模式下,设置ViewGroup, pickerView将会添加到这个ViewGroup中
    
    opened by weiyu199202 0
  • 自用 AndroidX 版本

    自用 AndroidX 版本

    opened by javakam 1
  • WheelView滚轮控件高度在代码与xml中设置match_parent无效,只有setLineSpacingMultiplier方法设置间距倍数吗?没有提供设置高度的外部方法吗?

    WheelView滚轮控件高度在代码与xml中设置match_parent无效,只有setLineSpacingMultiplier方法设置间距倍数吗?没有提供设置高度的外部方法吗?

    `

    <com.contrarywind.view.WheelView
        android:id="@+id/options1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@color/text_red_color" />
    
    <com.contrarywind.view.WheelView
        android:id="@+id/options2"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" />
    
    <com.contrarywind.view.WheelView
        android:id="@+id/options3"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" />
    

    `

    opened by chen-fuhai 0
Owner
Bigkoo
专注移动应用开发
Bigkoo
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
This is a android custom view , like a scratch card effect!

ScratchView This is a android custom view , like a scratch card effect! Last Update 采纳DearZack童鞋的优化思路,把计算擦除面积比例的操作放在手指离开屏幕时,以降低对CPU的占用。 Articles Scrat

D_clock爱吃葱花 316 Nov 29, 2022
Pop animation with circular dust effect for any view updation

Popview-Android Pop animation with circular dust effect for any view updation Getting Started In your build.gradle dependencies { compile 'rb.popv

R B Krishna 489 Dec 28, 2022
A color picker and a color preference for use in Android applications.

HSV-Alpha Color Picker for Android This library implements a color picker and a color preference for use in Android applications. Features I couldn't

Martin Stone 279 Nov 26, 2022
Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.

Android StackBlur Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. Th

Enrique López Mañas 3.6k Dec 29, 2022
A file/directory-picker for android. Implemented as a library project.

Note: avoid using as SD-card file picker on Kitkat+ In Kitkat or above, use Android's built-in file-picker instead. Google has restricted the ability

Jonas Kalderstam 711 Dec 27, 2022
A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Dionysis Lorentzos 2.3k Dec 9, 2022
Android ImageViews animated by Ken Burns Effect

KenBurnsView Android library that provides an extension to ImageView that creates an immersive experience by animating its drawable using the Ken Burn

Flávio Faria 2.7k Dec 23, 2022
A TagView library for Android. Customize your own & Drag effect.

AndroidTagView An Android TagView library. You can customize awesome TagView by using this library. Screenshots Usage Step 1 Add below dependency in y

lujun 1.7k Dec 29, 2022
JetCompose - Blur Effect in Android 12 with motion layout carousel

JetCompose Blur Effect in Android 12 with motion layout carousel

Vikas Singh 4 Jul 27, 2022
Google Calendar Recurrence picker

Android Recurrence Picker Google Calendar Recurrence picker Screenshot Usage Maven / Gradle Maven: <dependency> <groupId>be.billington.calendar.recu

Benoit Billington 240 Nov 29, 2022
A color picker for Jetpack compose 🎨

Compose Color Picker ?? Color Picker for Jetpack compose A color picker for Jetpack compose ?? Download ?? Working on it ?? Usage ColorPicker { co

mhssn 12 Dec 8, 2022
Glass-break effect for views

BrokenView Glass-break effect for views. Demo Download APK Usage Android Studio dependencies { compile 'com.zys:brokenview:1.0.3' } Eclipse Just pu

null 858 Jan 6, 2023
An Index Side Bar With Wave Effect

WaveSideBar You can use WaveSideBar in the contacts page of your application. Refer to AlexLiuSheng/AnimSideBar. Screenshot Include the WaveSideBar to

郭佳哲 1.3k Dec 12, 2022
Squishy button effect with kotlin

Squishy Usage Add squishy() modifier on your composable element. Text( text = "Squishhhhyyyyy", modifier = Modifier .size(200.dp, 100.dp

null 43 Jul 9, 2022
Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.

CircleDisplay Android View for displaying and selecting (by touch) values / percentages in a circle-shaped View, with animations. Features Core featur

Philipp Jahoda 287 Nov 18, 2022
FloatingView can make the target view floating above the anchor view with cool animation

FloatingView FloatingView can make the target view floating above the anchor view with cool animation Links 中文版 README Blog about FloatingView demo.ap

UFreedom 1.8k Dec 27, 2022
用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View.

PathAnimView 用于做Path动画的自定义View。 I have a path.I have a view. (Oh~),Path(Anim)View. 现已经找到图片->SVG->PATH的正确姿势, Now i have a pic.I have a view. Oh~,Path(A

张旭童 1.1k Oct 28, 2022
Extend From VLayout, and it will support Android X

XVLayout Extend From VLayout, and it will support Android X 从VLayout库克隆,支持Android X的RecyclerView 详细使用说明,参考:https://github.com/alibaba/vlayout Main Fea

null 1 Dec 8, 2021