⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maplocationviewer.java

📁 Android平台上实现流化播放
💻 JAVA
字号:
package com.pocketjourney.view;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

import com.google.android.maps.MapView;

public class MapLocationViewer extends LinearLayout {

	private MapLocationOverlay overlay;
	
    //  Known latitude/longitude coordinates that we'll be using.
    private List<MapLocation> mapLocations;
    
    private MapView mapView;
    
	public MapLocationViewer(Context context, AttributeSet attrs) {
		super(context, attrs);
		init();
	}

	public MapLocationViewer(Context context) {
		super(context);
		init();
	}

	public void init() {		

		setOrientation(VERTICAL);
		setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));

		mapView = new MapView(getContext(),"0DUEIIn35xtmC6Vk1JkFEF74kwkUjgb7HrUMKfA");
		mapView.setEnabled(true);
		mapView.setClickable(true);
		addView(mapView);

		overlay = new MapLocationOverlay(this);
		mapView.getOverlays().add(overlay);

    	mapView.getController().setZoom(14);
    	mapView.getController().setCenter(getMapLocations().get(0).getPoint());
	}
	
	public List<MapLocation> getMapLocations() {
		if (mapLocations == null) {
			mapLocations = new ArrayList<MapLocation>();
			mapLocations.add(new MapLocation("North Beach",37.799800872802734,-122.40699768066406));
			mapLocations.add(new MapLocation("China Town",37.792598724365234,-122.40599822998047));
			mapLocations.add(new MapLocation("Fisherman's Wharf",37.80910110473633,-122.41600036621094));
			mapLocations.add(new MapLocation("Financial District",37.79410171508789,-122.4010009765625));
		}
		return mapLocations;
	}

	public MapView getMapView() {
		return mapView;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -