Android intermediate-level Baidu map SDK v3.5.0-FragmentMap framework [graphic SupportMapFragment class] And androidsdk installation Diagram

Source: Internet
Author: User

Android intermediate-level Baidu map SDK v3.5.0-FragmentMap framework [graphic SupportMapFragment class] And androidsdk installation Diagram
Create a Fragment-Based Map Framework

  • SupportMapFragment

    SupportMapFragmentClass to manage the map lifecycle.

  • Constructor Overview

    Constructor and description:

    SupportMapFragment()Constructor

  • Method Overview
    Qualifier and type Method Description
    BaiduMap GetBaiduMap () Obtain the Baidu map controller. It is called after the onCreateView function is executed. Otherwise, null is returned.
    MapView GetMapView () Get Baidu map control
    Static SupportMapFragment NewInstance () Create a MapFragment instance
    Static SupportMapFragment NewInstance (BaiduMapOptions options) Create a SupportMapFragment instance based on the given Baidu map Option
    Void OnActivityCreated (Bundle savedInstanceState) *
    Void OnAttach (Activity activity) *
    Void OnConfigurationChanged (Configuration newConfig) It is called when the configuration is changed
    Void OnCreate (Bundle savedInstanceState) *
    View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) *
    Void OnDestroy () *
    Void OnDestroyView () *
    Void OnDetach () *
    Void OnPause () *
    Void OnResume () *
    Void OnSaveInstanceState (Bundle outState) *
    Void OnStart () *
    Void OnStop () *
    Void OnViewCreated (View view, Bundle savedInstanceState) *
    Void OnViewStateRestored (Bundle savedInstanceState) *
  • Use of MapFragment

    Createactivity_fragment.xml:

    <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical">    <FrameLayout        android:id="@+id/fm_map"        android:layout_width="match_parent"        android:layout_height="match_parent"></FrameLayout></LinearLayout>

    CreateMapFragmentDemoClass inheritanceBaseActivity:

    Public class MapFragmentDemo extends BaseActivity {private suppmapmapfragment map; private FragmentManager fm; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_fragment); // overlook: zoom down; zoom: zoom MapStatus MS = new MapStatus. builder (). overlook (-20 ). zoom (15 ). build (); // whether compassEnabled enables the compass; zoomControlsEnabled: whether to scale proportionally; BaiduMapOptions bo = new BaiduMapOptions (). mapStatus (MS ). compassEnabled (false ). zoomControlsEnabled (false); map = SupportMapFragment. newInstance (bo); fm = getSupportFragmentManager (); fm. beginTransaction (). add (R. id. fm_map, map, "map_fragemnt "). commit ();}}

    Run:

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.