第一步:Gradle引用
compile'liji.library.dev:citypickerview:0.1.0'
第二步:代码示例
CityPickerView cityPickerView = new CityPickerView(MainActivity.this);
cityPickerView.setOnCityItemClickListener(new CityPickerView.OnCityItemClickListener() {
@Override
public void onSelected(String... citySelected) {
//省份
String province = citySelected[0];
//城市
String city = citySelected[1];
//区县
String district = citySelected[2];
//邮编
String code = citySelected[3];
Toast.makeText(MainActivity.this,province+"-"+city+"-"+district,Toast.LENGTH_LONG).show();
}
});
cityPickerView.show();
compile'liji.library.dev:citypickerview:0.1.0'
第二步:代码示例
CityPickerView cityPickerView = new CityPickerView(MainActivity.this);
cityPickerView.setOnCityItemClickListener(new CityPickerView.OnCityItemClickListener() {
@Override
public void onSelected(String... citySelected) {
//省份
String province = citySelected[0];
//城市
String city = citySelected[1];
//区县
String district = citySelected[2];
//邮编
String code = citySelected[3];
Toast.makeText(MainActivity.this,province+"-"+city+"-"+district,Toast.LENGTH_LONG).show();
}
});
cityPickerView.show();