Code Monkey home page Code Monkey logo

citypicker's Introduction

CityPicker

**省市区街道四级选择器 Android CityPicker.

省市区街道数据来源

来自 https://github.com/modood/Administrative-divisions-of-China

数据库

使用了GreenDao https://github.com/greenrobot/greenDAO

Setup

Gradle
implementation 'com.liliang4869:CityPicker:1.0.1'

Usage

//application中初始化
CityPicker.getInstance().init(this);

使用dialog

 CityPickerDialog cityPickerDialog = CityPicker.getInstance().buildCityPickerDialog(MainActivity.this);
 //cityPickerDialog.setCheckedData("北京市",
 //                     "市辖区",
 //                   "东城区",
 //                 "朝阳门街道");
 cityPickerDialog.setCheckedData("河南省",
                        "郑州市",
                        null,
                        null);
   cityPickerDialog.setCityPickerListener(new CityPickView.CityPickerListener() {
            @Override
            public void cancel() {
                //点击取消
            }

            @Override
            public void confirm(Province province, City city, District district, Street street) {
              //选择完毕 点击确认
               Log.d("//Province",province==null?"NotSelect":province.getName());
               Log.d("//City",city==null?"NotSelect":city.getName());
               Log.d("//District",district==null?"NotSelect": district.getName());
               Log.d("//Street",street==null?"NotSelect":street.getName());
            }
        });
        cityPickerDialog.show();

不使用Dialog

<com.liliang4869.citypicker.view.CityPickView
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

Screenshot

img

citypicker's People

Contributors

liliang4869 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.