效果图
省市区3级联动.gif
使用
compile 'com.cool:cityselect:1.0.2'
new CitySelect(this)
.setMainColor(Color.RED)
.listener(new CitySelect.OnSelectListener() {
@Override
public void onSelect(String province, String city, String area) {
Log.e("399",province + " " + city + " " + area);
Toast.makeText(MainActivity.this,province + " " + city + " " + area,Toast.LENGTH_SHORT).show();
}
}).dialog()
.show();
if(mContainer.getChildCount() != 0){
mContainer.removeAllViews();
}
CitySelect citySelect = new CitySelect(this)
.setMainColor(Color.RED);
citySelect.listener(new CitySelect.OnSelectListener() {
@Override
public void onSelect(String province, String city, String area) {
Log.e("399",province + " " + city + " " + area);
Toast.makeText(MainActivity.this,province + " " + city + " " + area,Toast.LENGTH_SHORT).show();
}
});
mContainer.addView(citySelect.getView());
}
如果需要导入自己的数据,调用此方法
setProvinceData(List<Province> provinces)
源码下载
特别感谢 _有时丶提供数据来源
网友评论