我正在尝试创建一个扩展版的MapView
。
问题在于定义了MapView
的扩展版本后,地图视图不会平移。
我在自定义地图视图中实现了onTouchListener
。
我还想知道是否有任何方法可以平移地图视图。
当使用相同的源代码与库存版本的MapView
时,问题不存在。
编辑
MyMapView源代码:
public class MyMapView extends MapView{
public MyMapView(Context context, String apiKey) {
super(context, apiKey);
}
public MyMapView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyMapView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if(event.getAction()==MotionEvent.ACTION_DOWN){
Log.v("MyMapView","Touched");
}
return false ;
}
}
我从MapActivity
中的onCreate()
函数开始。
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.mapper);
mMapView=(MyMapView) findViewById(R.id.mapper_map);
mMapView.setSatellite(false);
}