- 支持地图:高德、腾讯、百度
- 界面支持自定义修改
Intent intent = new Intent(MainActivity.this, ActivityMapMainIndex.class);
startActivityForResult(intent, ActivityMapMainIndex.KEY_REQUEST_CODE);
Intent intent = new Intent(MainActivity.this, ActivityMapMainIndex.class);
//修改ui的属性
Customize customize = new Customize();
customize.setBgColor(getResourcesColor(R.color.colorAccent));
customize.setBackText(getResourcesString(R.string.back_name));
customize.setBackColor(getResourcesColor(R.color.colorPrimary));
customize.setTitle(getResourcesString(R.string.title));
customize.setTitleColor(getResourcesColor(R.color.colorPrimary));
customize.setSearchIcon(R.mipmap.ic_search);
customize.setConfirmBg(R.drawable.confirm_bg);
customize.setConfirmText(getResourcesString(R.string.confirm));
customize.setConfirmTextColor(getResourcesColor(R.color.colorPrimary));
customize.setLocationCenterIcon(R.mipmap.location);
customize.setLocationBackIcon(R.mipmap.location_back);
customize.setRvSelectIcon(R.mipmap.select);
customize.setSearchBackIcon(R.mipmap.back);
customize.setSearchInputHint("请输入地址");
//传入对象对可重新更改ui界面
intent.putExtra(ActivityMapMainIndex.KEY_CUSTOMIZE_UI, customize);
startActivityForResult(intent, ActivityMapMainIndex.KEY_REQUEST_CODE);
if(requestCode == ActivityMapMainIndex.KEY_REQUEST_CODE && resultCode == ActivityMapMainIndex.KEY_RESULT_CODE_SUCCESS){
AddressDetail ad = data.getParcelableExtra(ActivityMapMainIndex.KEY_RESULT_DATA);
tvResult.setText(ad.getDetail());
}
找到 map.main 项目下的 ActivityMapMainIndex
//腾讯地图
fmMain = new FragmentTencentSelectAdr();
//高德地图
fmMain = new FragmentGaoDeSelectAdr();
//百度地图
fmMain = new FragmentBaiDuSelectAdr();
找到 map.main 项目下的 ActivityMapMainIndex
//腾讯搜索
bundle.putInt(ActivityMapMainSearch.DATA_SOURCE_KEY, ActivityMapMainSearch.DATA_SOURCE_TENCENT);
//高德搜索
bundle.putInt(ActivityMapMainSearch.DATA_SOURCE_KEY, ActivityMapMainSearch.DATA_SOURCE_GAO_DE);
//百度搜索
bundle.putInt(ActivityMapMainSearch.DATA_SOURCE_KEY, ActivityMapMainSearch.DATA_SOURCE_BAI_DU);