2011-04-22 65 views
0

我有2个活动。在主要活动中,我开始与MapView的MapView工作不正确

Intent set = new Intent(); 
set.setClass(getApplicationContext(), OrderMap.class); 
startActivity(set); 

的onCreate新的活动在图形页面

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.map); 
    mapView = (MapView) findViewById(R.id.mymapview); 
    mapView.setBuiltInZoomControls(true); 
    } 

但没有缩放控制,它看起来像视图“冻结”。我无法移动地图。怎么了?

+0

您是否正在使用MapActivity扩展您的活动? – 2011-04-22 17:41:13

回答

3

android:clickable="true"添加到您的布局中的MapView小部件。

+0

我有这个xml我的视图 2011-04-22 18:57:14

+0

@Dima Svinarenko:嗯,那当然好了。以下是一个可以用于比较的示例项目:https://github.com/commonsguy/cw-android/tree/master/Maps/NooYawk – CommonsWare 2011-04-22 19:00:07

+0

看起来很好。正如其中一位评论者指出的那样,确保你从'MapActivity'扩展你的活动。 – Xion 2011-04-22 19:01:38