2011-07-14 7 views
0

私はxmlでこのレイアウトを持っています。そして、私が下のアクティビティを実行すると、ボタンを除いて何も表示されません。MapViewはこれで表示されていませんか?

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


    <Button 
    android:id="@+id/sat" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Satellite" 
    android:onClick="myClickHandler" 
    android:padding="8px"/> 
    <Button 
    android:id="@+id/street" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Street" 
    android:onClick="myClickHandler" 
    android:padding="8px"/> 
    <Button 
    android:id="@+id/traffic" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Traffic" 
    android:onClick="myClickHandler" 
    android:padding="8px"/> 
    <Button 
    android:id="@+id/normal" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Normal" 
    android:onClick="myClickHandler" 
    android:padding="8px"/> 
</LinearLayout> 

<com.google.android.maps.MapView 
android:id="@+id/mapView" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:clickable="true" 
android:apiKey= 
/> 
</LinearLayout> 

何らかの理由で、私が見ることができるのは、上部のボタンだけです。自分のアクティビティが実行されてもマップは表示されません。

ここにMapActivityのコードもあります。

public class meeting_map extends MapActivity{ 
private MapView mapView; 

@Override 
protected void onCreate(Bundle savedInstanceState){ 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.mapview); 

    mapView = (MapView)findViewById(R.id.mapView); 
    mapView.setBuiltInZoomControls(true); 
} 
public void myClickHandler(View target){ 
    switch(target.getId()){ 
    case R.id.sat: 
     mapView.setSatellite(true); 
     break; 
    case R.id.street: 
     mapView.setStreetView(true); 
     break; 
    case R.id.traffic: 
     mapView.setTraffic(true); 
     break; 
    case R.id.normal: 
     mapView.setSatellite(false); 
     mapView.setTraffic(false); 
     mapView.setStreetView(false); 
     break; 

    } 
} 
@Override 
    protected boolean isLocationDisplayed(){ 
    return false; 
} 
@Override 
protected boolean isRouteDisplayed() { 
    // TODO Auto-generated method stub 
    return false; 
} 


} 

多分私に何かが不足しています。

+0

私はあなたの実際のAPIキーを取り出しました、それはおそらく唯一のデバッグキーであり、それは証明書に一致する必要がありますが、私は思ってはいけません。 – Idistic

+0

おっと、私は編集権を「ピアレビュー」しているだけなので、自分自身で – Idistic

答えて

1

2番目のLinearLayoutのandroid:layout_height = "fill_parent"をandroid:layout_height = "wrap_content"に変更し、android:layout_height = "wrap_content"をandroid:layout_height = "fill_parent"に変更すると、有効なAPIキー+ AndroidManifest.xmlファイルにandroid.permission.INTERNETが設定されていると仮定します)。

+0

を変更し、2番目のレイアウトでXMLスキームも削除したいと思うかもしれません。それはxmlのルート要素でのみ必要です –

+0

私は今Eclipseのグラフィックレイアウトでmapviewを見ることができます。現在のテーマでスタイル 'mapViewStyle'を見つけることができませんでした。それが重要かどうかわかりません。 – yoshi24

+0

私はMapActivity 07-14 09:18:43.160:ERROR/MapActivity(30591):接続ファクトリクライアントを取得できませんでした。面白いクライアント接続を得ることができないと言います。 – yoshi24

関連する問題