| java.lang.Object | ||
| ↳ | BaseMapView | |
| ↳ | com.tencent.tencentmap.mapsdk.maps.MapView | |
Known Direct Subclasses
|
一个显示地图的视图(View)。它负责从服务端获取地图数据。它将会捕捉屏幕触控手势事件。
使用这个类必须按照它的生命周期进行操控,你必须参照以下方法onCreate(Bundle)、
onStart()、 onResume()、onPause()、onStop()、onDestroy()等声明
周期函数| Public Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| MapView(Context context) | |||||||||||
| MapView(Context context, TencentMapOptions options) | |||||||||||
| MapView(Context context, AttributeSet attrs) | |||||||||||
| MapView(Context context, AttributeSet attrs, TencentMapOptions options) | |||||||||||
| MapView(Context context, AttributeSet attrs, int defStyleAttr) | |||||||||||
| MapView(Context context, AttributeSet attrs, int defStyleAttr, TencentMapOptions options) | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| boolean | dispatchTouchEvent(MotionEvent ev) | ||||||||||
| TencentMap |
getMap()
获取默认地图实例
| ||||||||||
| 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(Object surfaceTexture, int width, int height)
当需要更新Surface时(支持Surface/SurfaceTexture/SurfaceHolder),调用此方法
| ||||||||||
| final boolean | onTouchEvent(MotionEvent event) | ||||||||||
| void |
setMapPadding(int left, int top, int right, int bottom)
设置底图相对上、下、左、右的边距
| ||||||||||
| void |
setOnTop(boolean isOnTop)
因为MapView最终是由 GLSurfaceView来绘制的,
所以当两个以上的MapView重叠的时候,需要调整它的上面关系时用到这个函数。其它就最终会调用SurfaceView.setZOrderOnTop(boolean)
| ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
获取底图相对上、下、左、右的边距
当需要更新Surface时(支持Surface/SurfaceTexture/SurfaceHolder),调用此方法
设置底图相对上、下、左、右的边距
| left | 左边距 |
|---|---|
| top | 上边距 |
| right | 右边距 |
| bottom | 下边距 |
因为MapView最终是由 GLSurfaceView来绘制的, 所以当两个以上的MapView重叠的时候,需要调整它的上面关系时用到这个函数。其它就最终会调用SurfaceView.setZOrderOnTop(boolean)
| isOnTop | true 当前的MapView在最上面 |
|---|