• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

CityPicker: 城市选择器,支持[1-4]级选择

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

CityPicker

开源软件地址:

https://gitee.com/yuqi101/city-picker

开源软件介绍:

CityPicker


用于城市选择器,仿京东收货地址样式,城市数据会持续更新,烦请留意。
支持 Level1省级、Level2省市级、Level3省市县、Level4省市县镇 共四个级别的条件选择。
组件中使用到 Gson(implementation 'com.google.code.gson:gson:2.8.7'),如有依赖冲突请留意解决。

效果图:



使用方法

  • 将 JitPack 存储库添加到您的构建文件
 allprojects {    repositories {       ...       maven { url 'https://jitpack.io' }    }  }
  • 添加依赖项
 dependencies {    implementation 'com.gitee.yuqi101:city-picker:1.0.1'  }
  • 代码中使用
 CityPickerDialog.Build(context)        .setLevel(level) // 设置联动等级,默认3级联动(CITY_PICKER_LEVEL3)        // 添加回调监听        .setAddressListener(new CityPickerDialog.AddressListener() {            @Override            public void callBack(int level, ProvinceEntity province, CityEntity city, AreaEntity area, TownEntity town) {                if(level == CityPickerDialog.CITY_PICKER_LEVEL1){                    result_tv.setText("您选择的地址:" + province.provinceName);                }                else if(level == CityPickerDialog.CITY_PICKER_LEVEL2){                    result_tv.setText("您选择的地址:" + province.provinceName + city.cityName);                }                else if(level == CityPickerDialog.CITY_PICKER_LEVEL3){                    result_tv.setText("您选择的地址:" + province.provinceName + city.cityName + area.areaName);                }                else if(level == CityPickerDialog.CITY_PICKER_LEVEL4){                    result_tv.setText("您选择的地址:" + province.provinceName + city.cityName + area.areaName + town.townName);                }            }        })        .setTitle("请选择地址") // 设置标题,默认不显示        .setTitleColor(R.color.text_999) // 设置标题的颜色,默认 #999999        .setSelectColor(R.color.primary) // 设置选中的颜色,默认 #FB593D        .setDefaultColor(R.color.text_color) // 设置未选中的颜色,默认 #333333        .setLineColor(R.color.primary) // 设置选中的线的颜色,默认 #FB593D        .show();

License

Copyright (C) Guoxin, CityPicker Open Source ProjectLicensed 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.0Unless required by applicable law or agreed to in writing, softwaredistributed 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 andlimitations under the License.

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap