2011-06-12 70 views
0

我试图做相关application.While一个谷歌地图这样做,应用程序,我得到了一些problems.This是我的xml文件谷歌地图应用

< LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

    <com.google.android.maps.MapView 
    android:id="@+id/mapView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:enabled="true" 
    android:clickable="true" 
    android:apiKey="0uw2roKAecBgrtyYUPVL-pJ84Ez4tfHTilFZCGw"/> 
     <LinearLayout android:id="@+id/zoom" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    /> 
    </LinearLayout> 

这是我的java文件

protected void onCreate(Bundle icicle) { 


    super.onCreate(icicle); 
    setContentView(R.layout.main); 
    mapView = (MapView) findViewById(R.id.mapView); 
       LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom); 
       View zoomView = mapView.getZoomControls(); 
       zoomLayout.addView(zoomView, 
       new LinearLayout.LayoutParams(
       LayoutParams.WRAP_CONTENT, 
       LayoutParams.WRAP_CONTENT)); 
     mapView.displayZoomControls(true); 
} 

我得到这个应用程序的谷歌地图视图,但没有放大。 如果我先改变我得到变焦options..what输出是线性layout.Pls的问题告诉我的朋友

回答

0

第一件事,改变你的最外层布局相对,因为我以为你要使用。 LinearLayout的问题是您忘记放置重量。 将android:layout_weight="1"设置为mapview,android:layout_weight="0"设为zooom控件布局。

+0

感谢所有....现在它的工作..... – Sarath 2011-06-15 04:58:16

0

控制缩放,平移,你需要定义

MapController mapController = mapView.getController(); 
其他行动

:)

0

中的onCreate试试这个:

mapView.setBuiltInZoomControls(true);