【AndroidPicker】停更两年,安卓选择器类库(WheelPicker、DatePicker、AddressPicker、ColorPicker、FilePicker)3.x全新版本重构来袭

8 篇文章 0 订阅
6 篇文章 0 订阅

AndroidPicker

安卓选择器类库,包括日期及时间选择器(可用于出生日期、营业时间等)、单项选择器(可用于性别、民族、职业、学历、星座等)、二三级联动选择器(可用于车牌号、基金定投日期等)、城市地址选择器(分省级、地市级及区县级)、数字选择器(可用于年龄、身高、体重、温度等)、日历选日期择器(可用于酒店及机票预定日期)、颜色选择器、文件及目录选择器等……WheelPicker/DatePicker/TimePicker/OptionPicker/NumberPicker/LinkagePicker/AddressPicker/CarNumberPicker/CalendarPicker/ColorPicker/FilePicker etc

欢迎大伙儿在Issues提交你的意见或建议。欢迎 Fork & Pull requests 贡献您的代码,大家共同学习【AndroidPicker 交流群 604235437】。

  • GitHub:https://github.com/gzu-liyujiang/AndroidPicker
  • 码云(GitEE):https://gitee.com/li_yu_jiang/AndroidPicker

依赖配置

allprojects {
    repositories {
        maven { url 'https://www.jitpack.io' }
    }
}

所有选择器的基础窗体:

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:<version>'
}

滚轮选择器的滚轮控件:

dependencies {
   implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelView:<version>'
}

单项/数字、二三级联动、日期/时间等滚轮选择器:

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelView:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:<version>'
}

省市区地址选择器:

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelView:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:AddressPicker:<version>'
}

文件/目录选择器:

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:FilePicker:<version>'
}

颜色选择器:

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:ColorPicker:<version>'
}

日历日期选择器:

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:<version>'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:CalendarPicker:<version>'
}

旧版本 Support 稳定版本

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:1.5.6.20181018'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:1.5.6.20181018'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:FilePicker:1.5.6.20181018'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:ColorPicker:1.5.6.20181018'
}

旧版本 AndroidX 稳定版本

dependencies {
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:2.0.0'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:2.0.0'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:FilePicker:2.0.0'
    implementation 'com.github.gzu-liyujiang.AndroidPicker:ColorPicker:2.0.0'
}

代码同时托管在GitHubGitEE,因此3.x及以上版本的依赖项也可以将com.github.gzu-liyujiang换成com.gitee.li_yu_jiang,即:

    implementation 'com.gitee.li_yu_jiang.AndroidPicker:Common:<version>'
    implementation 'com.gitee.li_yu_jiang.AndroidPicker:WheelView:<version>'
    implementation 'com.gitee.li_yu_jiang.AndroidPicker:WheelPicker:<version>'
    implementation 'com.gitee.li_yu_jiang.AndroidPicker:AddressPicker:<version>'
    implementation 'com.gitee.li_yu_jiang.AndroidPicker:ColorPicker:<version>'
    implementation 'com.gitee.li_yu_jiang.AndroidPicker:FilePicker:<version>'
    implementation 'com.gitee.li_yu_jiang.AndroidPicker:CalendarPicker:<version>'

混淆规则

项目库混淆无需额外配置。

用法示例

常见用法请参阅 demo,高级用法请细读源码。强烈建议拉取代码运行,尝试修改 demo 对比查看实际效果以便加深理解。

在 Java 中

        OptionPicker picker = new OptionPicker(this);
        picker.setBackgroundColor(true, 0xFFFFFFFF);
        picker.setData("测试", "很长很长很长很长很长很长很长很长很长很长很长很长很长很长");
        picker.setOnOptionPickedListener(this);
        picker.getTitleView().setText("这是标题");
        picker.getWheelView().setCyclicEnabled(true);
        picker.getWheelView().setCurvedEnabled(true);
        picker.getWheelView().setCurvedMaxAngle(60);
        picker.show();
        AddressPicker picker = new AddressPicker(this);
        picker.setAddressMode(AddressMode.PROVINCE_CITY_COUNTY);
        picker.setDefaultValue("贵州省", "贵阳市", "观山湖区");
        picker.setOnAddressPickedListener(this);
        picker.show();

在 XML 中

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <com.github.gzuliyujiang.wheelpicker.widget.OptionWheelLayout
                android:id="@+id/wheel_option"
                android:layout_width="90dp"
                android:layout_height="150dp"
                android:layout_gravity="center_horizontal"
                app:wheel_itemTextAlign="center" />

            <com.github.gzuliyujiang.wheelpicker.widget.LinkageWheelLayout
                android:id="@+id/wheel_linkage"
                android:layout_width="match_parent"
                android:layout_height="150dp"
                app:wheel_curtainColor="#FFF1F1F1"
                app:wheel_curtainEnabled="true"
                app:wheel_indicatorEnabled="false" />

            <com.github.gzuliyujiang.wheelpicker.widget.NumberWheelLayout
                android:layout_width="90dp"
                android:layout_height="150dp"
                android:layout_gravity="center_horizontal"
                app:wheel_curvedEnabled="true"
                app:wheel_curvedMaxAngle="45"
                app:wheel_label=""
                app:wheel_maxNumber="30"
                app:wheel_minNumber="10"
                app:wheel_stepNumber="5"
                app:wheel_visibleItemCount="7" />

            <com.github.gzuliyujiang.wheelpicker.widget.DatimeWheelLayout
                android:layout_width="match_parent"
                android:layout_height="150dp"
                app:wheel_dateMode="year_month_day"
                app:wheel_indicatorColor="#FFEEEEEE"
                app:wheel_indicatorSize="5dp"
                app:wheel_timeMode="hour_12_no_second" />

            <com.github.gzuliyujiang.wheelpicker.widget.DateWheelLayout
                android:layout_width="120dp"
                android:layout_height="150dp"
                android:layout_gravity="center_horizontal"
                app:wheel_dateMode="month_day"
                app:wheel_dayLabel=""
                app:wheel_monthLabel="" />

            <com.github.gzuliyujiang.wheelpicker.widget.TimeWheelLayout
                android:layout_width="95dp"
                android:layout_height="150dp"
                android:layout_gravity="center_horizontal"
                app:wheel_curvedEnabled="true"
                app:wheel_curvedMaxAngle="45"
                app:wheel_hourLabel=":"
                app:wheel_minuteLabel=":"
                app:wheel_timeMode="hour_24_has_second" />

        </LinearLayout>

效果预览

以下图片显示的效果可能已修改过,实际效果请运行 demo 查看。

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

特别鸣谢

许可协议

3.0.0 之后

Copyright (c) 2020-2021 gzu-liyujiang <1032694760@qq.com>

The software is licensed under the Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
    http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
PURPOSE.
See the Mulan PSL v2 for more details.

3.0.0 之前

MIT License

Copyright (c) 穿青山魈人马<liyujiang_tk@yeah.net>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 19
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值