public class MapView
extends BaseMapView
使用这个类必须按照它的生命周期进行操控,你必须参照以下方法onCreate(Bundle)、
onStart()、 onResume()、onPause()、onStop()、onDestroy()等声明
周期函数| 构造器和说明 |
|---|
MapView(Context context) |
MapView(Context context,
AttributeSet attrs) |
MapView(Context context,
AttributeSet attrs,
int defStyleAttr) |
MapView(Context context,
AttributeSet attrs,
int defStyleAttr,
TencentMapOptions options) |
MapView(Context context,
AttributeSet attrs,
TencentMapOptions options) |
MapView(Context context,
TencentMapOptions options) |
| 限定符和类型 | 方法和说明 |
|---|---|
TencentMap |
getMap()
获取默认地图实例
|
TencentMap |
getMap(TencentMapOptions options)
获取地图实例
|
int[] |
getMapPadding()
获取底图相对上、下、左、右的边距
|
void |
onDestroy() |
void |
onPause() |
void |
onRestart() |
void |
onResume() |
void |
onSizeChanged(int w,
int h,
int oldw,
int oldh) |
void |
onStart() |
void |
onStop() |
void |
onSurfaceChanged(java.lang.Object surfaceTexture,
int width,
int height)
当需要更新Surface时(支持Surface/SurfaceTexture/SurfaceHolder),调用此方法
|
boolean |
onTouchEvent(MotionEvent event) |
void |
setMapPadding(int left,
int top,
int right,
int bottom)
设置底图相对上、下、左、右的边距
|
void |
setOnTop(boolean isOnTop)
因为MapView最终是由 GLSurfaceView来绘制的,
所以当两个以上的MapView重叠的时候,需要调整它的上面关系时用到这个函数。
|
public MapView(Context context)
public MapView(Context context,
TencentMapOptions options)
public MapView(Context context,
AttributeSet attrs)
public MapView(Context context,
AttributeSet attrs,
TencentMapOptions options)
public MapView(Context context,
AttributeSet attrs,
int defStyleAttr)
public MapView(Context context,
AttributeSet attrs,
int defStyleAttr,
TencentMapOptions options)
public TencentMap getMap()
public TencentMap getMap(TencentMapOptions options)
options - 地图选项public final boolean onTouchEvent(MotionEvent event)
public void onStart()
public void onResume()
public void onPause()
public void onRestart()
public void onStop()
public void onDestroy()
public void setOnTop(boolean isOnTop)
isOnTop - true 当前的MapView在最上面public void setMapPadding(int left,
int top,
int right,
int bottom)
left - 左边距top - 上边距right - 右边距bottom - 下边距public int[] getMapPadding()
public void onSizeChanged(int w,
int h,
int oldw,
int oldh)
public void onSurfaceChanged(java.lang.Object surfaceTexture,
int width,
int height)
surfaceTexture - width - height -