public class MapView
extends android.widget.FrameLayout
A MapView
provides an embeddable map interface.
You use this class to display map information and to manipulate the map contents from your application.
You can center the map on a given coordinate, specify the size of the area you want to display,
and style the features of the map to fit your application's use case.
Use of MapView
requires a Mapbox API access token.
Obtain an access token on the Mapbox account page.
Modifier and Type | Class and Description |
---|---|
static interface |
MapView.MapChange
Definition of a map change event.
|
static interface |
MapView.OnMapChangedListener
Interface definition for a callback to be invoked when the displayed map view changes.
|
android.widget.FrameLayout.LayoutParams
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
Modifier and Type | Field and Description |
---|---|
static int |
DID_FAIL_LOADING_MAP
This event is triggered when the map has failed to load a new map style.
|
static int |
DID_FINISH_LOADING_MAP
This is triggered when the map has successfully loaded a new map style.
|
static int |
DID_FINISH_LOADING_STYLE
This
MapView.MapChange is triggered when a style has finished loading. |
static int |
DID_FINISH_RENDERING_FRAME
This event is triggered when the map finished rendering a frame.
|
static int |
DID_FINISH_RENDERING_FRAME_FULLY_RENDERED
This event is triggered when the map finished rendeirng the frame fully.
|
static int |
DID_FINISH_RENDERING_MAP
This event is triggered when the map finished rendering the map.
|
static int |
DID_FINISH_RENDERING_MAP_FULLY_RENDERED
This event is triggered when the map is fully rendered.
|
static int |
REGION_DID_CHANGE
This event is triggered whenever the currently displayed map region finished changing
without an animation.
|
static int |
REGION_DID_CHANGE_ANIMATED
This event is triggered whenever the currently displayed map region finished changing
with an animation.
|
static int |
REGION_IS_CHANGING
This event is triggered whenever the currently displayed map region is changing.
|
static int |
REGION_WILL_CHANGE
This event is triggered whenever the currently displayed map region is about to changing
without an animation.
|
static int |
REGION_WILL_CHANGE_ANIMATED
This event is triggered whenever the currently displayed map region is about to changing
with an animation.
|
static int |
WILL_START_LOADING_MAP
This event is triggered when the map is about to start loading a new map style.
|
static int |
WILL_START_RENDERING_FRAME
This event is triggered when the map will start rendering a frame.
|
static int |
WILL_START_RENDERING_MAP
This event is triggered when the map will start rendering the map.
|
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z
Constructor and Description |
---|
MapView(android.content.Context context) |
MapView(android.content.Context context,
android.util.AttributeSet attrs) |
MapView(android.content.Context context,
android.util.AttributeSet attrs,
int defStyleAttr) |
MapView(android.content.Context context,
MapboxMapOptions options) |
Modifier and Type | Method and Description |
---|---|
void |
addOnMapChangedListener(MapView.OnMapChangedListener listener)
Add a callback that's invoked when the displayed map view changes.
|
java.lang.String |
getAccessToken()
Deprecated.
As of release 4.1.0, replaced by
MapboxAccountManager.getAccessToken() |
void |
getMapAsync(OnMapReadyCallback callback)
Sets a callback object which will be triggered when the
MapboxMap instance is ready to be used. |
android.view.ViewGroup |
getMarkerViewContainer() |
java.util.List<MarkerView> |
getMarkerViewsInRect(android.graphics.RectF rect) |
java.lang.String |
getStyleUrl()
Returns the map style currently displayed in the map view.
|
void |
invalidateContentPadding() |
void |
onCreate(android.os.Bundle savedInstanceState)
You must call this method from the parent's
Activity.onCreate(Bundle) or
Fragment.onCreate(Bundle) . |
void |
onDestroy()
You must call this method from the parent's
Activity.onDestroy() or Fragment.onDestroy() . |
protected void |
onDetachedFromWindow() |
void |
onDraw(android.graphics.Canvas canvas) |
protected void |
onFpsChanged(double fps) |
boolean |
onGenericMotionEvent(android.view.MotionEvent event) |
boolean |
onHoverEvent(android.view.MotionEvent event) |
protected void |
onInvalidate() |
boolean |
onKeyDown(int keyCode,
android.view.KeyEvent event) |
boolean |
onKeyLongPress(int keyCode,
android.view.KeyEvent event) |
boolean |
onKeyUp(int keyCode,
android.view.KeyEvent event) |
void |
onLowMemory()
You must call this method from the parent's
Activity.onLowMemory() or Fragment.onLowMemory() . |
protected void |
onMapChanged(int mapChange) |
void |
onPause()
You must call this method from the parent's
Activity.onPause() or Fragment.onPause() . |
void |
onResume()
You must call this method from the parent's
Activity.onResume() or Fragment.onResume() . |
void |
onSaveInstanceState(android.os.Bundle outState)
You must call this method from the parent's
Activity.onSaveInstanceState(Bundle)
or Fragment.onSaveInstanceState(Bundle) . |
protected void |
onSizeChanged(int width,
int height,
int oldw,
int oldh) |
protected void |
onSnapshotReady(byte[] bytes) |
boolean |
onTouchEvent(android.view.MotionEvent event) |
boolean |
onTrackballEvent(android.view.MotionEvent event) |
protected void |
onVisibilityChanged(android.view.View changedView,
int visibility) |
void |
removeOnMapChangedListener(MapView.OnMapChangedListener listener)
Remove a callback added with
addOnMapChangedListener(OnMapChangedListener) |
void |
setAccessToken(java.lang.String accessToken)
Deprecated.
As of release 4.1.0, replaced by
MapboxAccountManager.start(Context, String) |
void |
setStyle(java.lang.String style)
Loads a new map style from the specified bundled style.
|
void |
setStyleUrl(java.lang.String url)
Loads a new map style from the specified URL.
|
checkLayoutParams, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getConsiderGoneChildrenWhenMeasuring, getMeasureAllChildren, onLayout, onMeasure, setForegroundGravity, setMeasureAllChildren, shouldDelayChildPressedState
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayout
addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onHoverChanged, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyMultiple, onKeyPreIme, onKeyShortcut, onOverScrolled, onPopulateAccessibilityEvent, onProvideStructure, onProvideVirtualStructure, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setForeground, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayout
public static final int REGION_WILL_CHANGE
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int REGION_WILL_CHANGE_ANIMATED
MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
public static final int REGION_IS_CHANGING
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int REGION_DID_CHANGE
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int REGION_DID_CHANGE_ANIMATED
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int WILL_START_LOADING_MAP
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FINISH_LOADING_MAP
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FAIL_LOADING_MAP
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int WILL_START_RENDERING_FRAME
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FINISH_RENDERING_FRAME
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FINISH_RENDERING_FRAME_FULLY_RENDERED
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int WILL_START_RENDERING_MAP
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FINISH_RENDERING_MAP
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FINISH_RENDERING_MAP_FULLY_RENDERED
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public static final int DID_FINISH_LOADING_STYLE
MapView.MapChange
is triggered when a style has finished loading.
Register to MapView.MapChange
events with addOnMapChangedListener(OnMapChangedListener)
.
public MapView(android.content.Context context)
public MapView(android.content.Context context, android.util.AttributeSet attrs)
public MapView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
public MapView(android.content.Context context, MapboxMapOptions options)
public void onCreate(android.os.Bundle savedInstanceState)
You must call this method from the parent's Activity.onCreate(Bundle)
or
Fragment.onCreate(Bundle)
.
setAccessToken(String)
before you this method
or an exception will be thrown.savedInstanceState
- Pass in the parent's savedInstanceState.setAccessToken(String)
public void onSaveInstanceState(android.os.Bundle outState)
Activity.onSaveInstanceState(Bundle)
or Fragment.onSaveInstanceState(Bundle)
.outState
- Pass in the parent's outState.public void onDestroy()
Activity.onDestroy()
or Fragment.onDestroy()
.public void onPause()
Activity.onPause()
or Fragment.onPause()
.public void onResume()
Activity.onResume()
or Fragment.onResume()
.public void onLowMemory()
Activity.onLowMemory()
or Fragment.onLowMemory()
.protected void onFpsChanged(double fps)
public void setStyleUrl(java.lang.String url)
Loads a new map style from the specified URL.
url
can take the following forms:
Style.*
: load one of the bundled styles in Style
.mapbox://styles/<user>/<style>
:
retrieves the style from a Mapbox account.
user
is your username. style
is the ID of your custom
style created in Mapbox Studio.http://...
or https://...
:
retrieves the style over the Internet from any web server.asset://...
:
reads the style from the APK assets/
directory.
This is used to load a style bundled with your app.null
: loads the default Style.MAPBOX_STREETS
style.
This method is asynchronous and will return immediately before the style finishes loading.
If you wish to wait for the map to finish loading listen for the DID_FINISH_LOADING_MAP
event.
DID_FAIL_LOADING_MAP
event will be sent.url
- The URL of the map styleStyle
public void setStyle(java.lang.String style)
Loads a new map style from the specified bundled style.
This method is asynchronous and will return immediately before the style finishes loading.
If you wish to wait for the map to finish loading listen for the DID_FINISH_LOADING_MAP
event.
DID_FAIL_LOADING_MAP
event will be sent.public java.lang.String getStyleUrl()
Returns the map style currently displayed in the map view.
If the default style is currently displayed, a URL will be returned instead of null.@Deprecated public void setAccessToken(java.lang.String accessToken)
MapboxAccountManager.start(Context, String)
DEPRECATED @see MapboxAccountManager#start(String)
Sets the current Mapbox access token used to load map styles and tiles.
You must set a valid access token before you call onCreate(Bundle)
or an exception will be thrown.
accessToken
- Your public Mapbox access token.onCreate(Bundle)
@Deprecated public java.lang.String getAccessToken()
MapboxAccountManager.getAccessToken()
DEPRECATED @see MapboxAccountManager#getAccessToken()
Returns the current Mapbox access token used to load map styles and tiles.
public java.util.List<MarkerView> getMarkerViewsInRect(android.graphics.RectF rect)
public android.view.ViewGroup getMarkerViewContainer()
public void invalidateContentPadding()
protected void onInvalidate()
public void onDraw(android.graphics.Canvas canvas)
onDraw
in class android.view.View
protected void onSizeChanged(int width, int height, int oldw, int oldh)
onSizeChanged
in class android.view.View
protected void onDetachedFromWindow()
onDetachedFromWindow
in class android.view.ViewGroup
protected void onVisibilityChanged(android.view.View changedView, int visibility)
onVisibilityChanged
in class android.view.View
public boolean onTouchEvent(android.view.MotionEvent event)
onTouchEvent
in class android.view.View
public boolean onKeyDown(int keyCode, android.view.KeyEvent event)
onKeyDown
in interface android.view.KeyEvent.Callback
onKeyDown
in class android.view.View
public boolean onKeyLongPress(int keyCode, android.view.KeyEvent event)
onKeyLongPress
in interface android.view.KeyEvent.Callback
onKeyLongPress
in class android.view.View
public boolean onKeyUp(int keyCode, android.view.KeyEvent event)
onKeyUp
in interface android.view.KeyEvent.Callback
onKeyUp
in class android.view.View
public boolean onTrackballEvent(android.view.MotionEvent event)
onTrackballEvent
in class android.view.View
public boolean onGenericMotionEvent(android.view.MotionEvent event)
onGenericMotionEvent
in class android.view.View
public boolean onHoverEvent(android.view.MotionEvent event)
onHoverEvent
in class android.view.View
public void addOnMapChangedListener(MapView.OnMapChangedListener listener)
Add a callback that's invoked when the displayed map view changes.
To remove the callback, useremoveOnMapChangedListener(OnMapChangedListener)
.listener
- The callback that's invoked on every frame rendered to the map view.removeOnMapChangedListener(OnMapChangedListener)
public void removeOnMapChangedListener(MapView.OnMapChangedListener listener)
addOnMapChangedListener(OnMapChangedListener)
listener
- The previously added callback to remove.addOnMapChangedListener(OnMapChangedListener)
protected void onMapChanged(int mapChange)
public void getMapAsync(OnMapReadyCallback callback)
MapboxMap
instance is ready to be used.callback
- The callback object that will be triggered when the map is ready to be used.protected void onSnapshotReady(byte[] bytes)