マピオンAPI


Android Maps APIドキュメント

GoogleMapsとマピオンマップを同時に表示する

import jp.co.mapion.android.maps.OnSizeChangedListener;
import jp.co.mapion.android.maps.R;
import jp.co.mapion.android.maps.ext.open.LightMap;
import android.os.Bundle;
import android.view.Window;
import android.widget.LinearLayout;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

public class SampleActivity extends MapActivity {
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		
		final LinearLayout layout = new LinearLayout(this);
		setContentView(layout);
		layout.setOrientation(LinearLayout.VERTICAL);
		setContentView(R.layout.both);
	
		final MapView mapView = (MapView) findViewById(R.id.gmap);
		mapView.setClickable(true);
		mapView.setBuiltInZoomControls(true);
		mapView.getController().setCenter(new GeoPoint(35300000, 139300000));
		mapView.getController().setZoom(12);
		
		jp.co.mapion.android.maps.MapView mmapView = new jp.co.mapion.android.maps.MapView(this, new LightMap("APIキー"));
		mmapView.setClickable(true);
		mmapView.setBuiltInZoomControls(true);
		
		final LinearLayout mapionMapLayout = (LinearLayout) findViewById(R.id.MapionMapLayout);
		mapionMapLayout.addView(mmapView);
		
		mmapView.getOnSizeChangedListeners().add(new OnSizeChangedListener() {
			@Override
			public void changed(int w, int h) {
				LinearLayout root = (LinearLayout) findViewById(R.id.RootLayout);
				int halfH = root.getHeight() / 2;
				mapView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, halfH));		
				mapionMapLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, halfH));
			}	
		});
	}
	
	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:id="@+id/RootLayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

	<com.google.android.maps.MapView
        android:id="@+id/gmap"
        android:apiKey="APIキー"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
        
    <LinearLayout
		android:id="@+id/MapionMapLayout"
	    android:layout_width="fill_parent"
	    android:layout_height="fill_parent"
	    />
	
</LinearLayout>