问题描述
- 关于android中listview点击item没有反应
- public class MapActivity extends BasePagerActivity {
private MapView mMapView = null;
private BaiduMap mBaiduMap;
private ListView map_menu_lv;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
initData();
}@Overridepublic void initData() { base_tv_title.setText(""街景秀""); SDKInitializer.initialize(getApplicationContext()); View view = View.inflate(MapActivity.this R.layout.map null); map_menu_lv = (ListView) view.findViewById(R.id.map_menu_lv); map_menu_lv.setAdapter(new MapMenuListViewAdapter(MapActivity.this)); weibo_menu.setVisibility(View.VISIBLE); weibo_menu.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub //Toast.makeText(MapActivity.thiswo"" 1).show(); map_menu_lv.setVisibility(View.VISIBLE); } }); mMapView = (MapView) view.findViewById(R.id.bmapView); mBaiduMap = mMapView.getMap(); MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f); mBaiduMap.setMapStatus(msu); **map_menu_lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0 View arg1 int arg2 long arg3) { // TODO Auto-generated method stub switch (arg2) { case 0: mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL); break; case 1: mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE); break; case 2: if(mBaiduMap.isTrafficEnabled()){ mBaiduMap.setTrafficEnabled(false); }else{ mBaiduMap.setTrafficEnabled(true); } break; default: break;** } } }); base_fr.addView(view);}@Overrideprotected void onDestroy() { super.onDestroy(); // 在activity执行onDestroy时执行mMapView.onDestroy(),实现地图生命周期管理 mMapView.onDestroy();}@Overrideprotected void onResume() { super.onResume(); // 在activity执行onResume时执行mMapView. onResume (),实现地图生命周期管理 mMapView.onResume();}@Overrideprotected void onPause() { super.onPause(); // 在activity执行onPause时执行mMapView. onPause (),实现地图生命周期管理 mMapView.onPause();}
}
请问标识出的部分为什么不能起到切换百度地图状态的功能?
解决方案
点击Android ListView 某一项item无反应解决办法
android中listview点击item不变色的问题
android listview item 点击无效解决
解决方案二:
切换没有反应吗?
http://blog.csdn.net/column/details/android-jacksen-map.html
解决方案三:
我看你的类都没有实现点击事件的接口,你是怎么写的setOnClickListener
时间: 2024-09-17 06:50:17