省市县三级联动,JS实现
- 爱生活,爱学习,更爱做代码的搬运工,分类查找更方便请下载黑马助手app
开源地址:https://github.com/open-android/CityPickerWebView
简书:http://www.jianshu.com/p/979983c6b0fe
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
compile 'com.github.open-android:CityPickerWebView:0.1.0'
cityPicker = new CityPicker(MainActivity.this, this);
findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cityPicker.show();
}
});
textView = (TextView) findViewById(R.id.textView);
findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
cityPicker.close();
}
});
@Override
public void getCity(final String name) {
textView.setText(name);
}
@Override
public void onBackPressed() {
if (cityPicker.isShow()){
cityPicker.close();
return;
}
super.onBackPressed();
}
详细的使用方法在DEMO里面都演示啦,如果你觉得这个库还不错,请赏我一颗star吧~~~
欢迎关注微信公众号