Giter Club home page Giter Club logo

ryxcitypicker's Introduction

CityPicker

Platform API

现在使用比较多的类似美团等APP的城市选择界面.

2步即可实现,就是这么简单粗暴!

Gif

image

APK

下载demo.apk体验.

还需要添加CityPickerActivity

<activity
            android:name="com.zaaach.citypicker.CityPickerActivity"
            android:theme="@style/CityPicker.NoActionBar"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustPan"/>

Step2:

private static final int REQUEST_CODE_PICK_CITY = 0;
 Intent intent=  new Intent(MainActivity.this, CityPickerActivity.class);
                intent.putExtra("locationcity","济南市");
                intent.putExtra("locationDistrict","高新区");

                hostCitys.add("济南");
                hostCitys.add("北京");
                hostCitys.add("安阳");
                hostCitys.add("泰山");
                hostCitys.add("泰山");
                hostCitys.add("泰山");
                hostCitys.add("泰山");
                hostCitys.add("泰山");
                hostCitys.add("泰山");
                intent.putStringArrayListExtra("hotCitys",hostCitys);
                startActivityForResult(intent,
                        REQUEST_CODE_PICK_CITY);

//重写onActivityResult方法
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE_PICK_CITY && resultCode == RESULT_OK){
        if (data != null){
            String city = data.getStringExtra(CityPickerActivity.KEY_PICKED_CITY);
            resultTV.setText("当前选择:" + city);
        }
    }
}

Step3:

enjoy it.

Proguard

注意混淆

//定位
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.fence.**{*;}
-keep class com.autonavi.aps.amapapi.model.**{*;}

ryxcitypicker's People

Contributors

xuchenchen avatar

Stargazers

 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.