Android ------ AndroidPicker(时间,日历,城市等选择器)

项目中要经常用到时间,日期,地区等选择器的功能,github上很多,我也使用了很多个了,简单的来分享一下

这个安卓选择器类库有哪些功能呢?

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

先来看看效果图:

依赖配置

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

所有选择器的基础窗体:目前最新是4.0.1 版本

dependencies {
    //选择器的基础窗体
    implementation 'com.github.gzu-liyujiang.AndroidPicker:Common:4.0.1'

    //滚轮选择器的滚轮控件
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelView:4.0.1'

    //单项/数字、二三级联动、日期/时间等滚轮选择器
    implementation 'com.github.gzu-liyujiang.AndroidPicker:WheelPicker:4.0.1'

    //文件/目录选择器:
    implementation 'com.github.gzu-liyujiang.AndroidPicker:FilePicker:4.0.1'

    //颜色选择器
    implementation 'com.github.gzu-liyujiang.AndroidPicker:ColorPicker:4.0.1'

    //省市区地址选择器
    implementation 'com.github.gzu-liyujiang.AndroidPicker:AddressPicker:4.0.1'

    //日历日期选择器:
    implementation 'com.github.gzu-liyujiang.AndroidPicker:CalendarPicker:4.0.1'

    //图片选择器
    implementation 'com.github.gzu-liyujiang.AndroidPicker:ImagePicker:4.0.1'

}
<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.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="月" />

    ...

</LinearLayout>

多种选择器使用,看详细源码

<com.github.gzuliyujiang.wheelview.widget.WheelView
    android:id="@+id/wheel_view"
    android:layout_width="117dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    app:wheel_atmosphericEnabled="true"
    app:wheel_curvedEnabled="true"
    app:wheel_curvedIndicatorSpace="4dp"
    app:wheel_curvedMaxAngle="60"
    app:wheel_indicatorColor="#FF0081FF"
    app:wheel_itemSpace="50dp"
    app:wheel_itemTextColor="#FF474747"
    app:wheel_itemTextColorSelected="#FF0081FF"
    app:wheel_itemTextSize="20sp" />

全局配置所有选择器样式及配色

//4.0版本开始内置支持四种弹窗样式(Default、One、Two、Three),效果可运行Demo查看
public class DemoApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        DialogConfig.setDialogStyle(DialogStyle.Default);
        DialogConfig.setDialogColor(new DialogColor()
                .cancelTextColor(0xFF999999)
                .okTextColor(0xFF0099CC));
    }

}

各版本介绍:



https://github.com/gzu-liyujiang/AndroidPicker/blob/master/ChangeLog.md

项目源码和参考地址:https://github.com/gzu-liyujiang/AndroidPicker

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值