本文整理汇总了Java中com.amap.api.maps.MapView.onCreate方法的典型用法代码示例。如果您正苦于以下问题:Java MapView.onCreate方法的具体用法?Java MapView.onCreate怎么用?Java MapView.onCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.maps.MapView
的用法示例。
在下文中一共展示了MapView.onCreate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test_basicmap_activity);
/*
* 设置离线地图存储目录,在下载离线地图或初始化地图设置;
* 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
* 则需要在离线地图下载和使用地图页面都进行路径设置
* */
//Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
// MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(savedInstanceState);// 此方法必须重写
init();
}
示例2: onCreateView
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View sView = inflater.inflate(R.layout.fragment_map_simple, container, false);
mMapView = (MapView) sView.findViewById(R.id.map_simple);
mMapView.onCreate(savedInstanceState);
AMap map = mMapView.getMap();
map.setMapType(AMap.MAP_TYPE_NIGHT);
map.getUiSettings().setZoomControlsEnabled(false);
map.getUiSettings().setAllGesturesEnabled(false);
LatLng loc = new LatLng(39.9793157, 116.3107618);
CameraUpdate mCameraUpdate = CameraUpdateFactory.newCameraPosition(new CameraPosition(loc,14 ,0,0));
map.animateCamera(mCameraUpdate, 1000, null);
if(mCircleTask == null) {
mCircleTask = new CircleTask(map, loc, 15, 20, 40);
}
return sView;
}
示例3: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geofence_new);
setTitle(R.string.districtGeoFence);
// 初始化地理围栏
fenceClient = new GeoFenceClient(getApplicationContext());
lyOption = findViewById(R.id.ly_option);
btAddFence = (Button) findViewById(R.id.bt_addFence);
tvResult = (TextView) findViewById(R.id.tv_result);
tvResult.setVisibility(View.GONE);
etCustomId = (EditText) findViewById(R.id.et_customId);
etKeyword = (EditText) findViewById(R.id.et_keyword);
cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);
init();
}
示例4: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geofence_new);
setTitle(R.string.roundGeoFence);
// 初始化地理围栏
fenceClient = new GeoFenceClient(getApplicationContext());
lyOption = findViewById(R.id.ly_option);
btAddFence = (Button) findViewById(R.id.bt_addFence);
btOption = (Button) findViewById(R.id.bt_option);
tvGuide = (TextView) findViewById(R.id.tv_guide);
tvResult = (TextView) findViewById(R.id.tv_result);
tvResult.setVisibility(View.GONE);
etCustomId = (EditText) findViewById(R.id.et_customId);
etRadius = (EditText) findViewById(R.id.et_radius);
cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);
markerOption = new MarkerOptions().draggable(true);
init();
}
示例5: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
//获取地图控件引用
mMapView = (MapView) findViewById(R.id.map);
//在activity执行onCreate时执行mMapView.onCreate(savedInstanceState),创建地图
mMapView.onCreate(savedInstanceState);
AMap aMap = mMapView.getMap();
aMap.setMapType(AMap.MAP_TYPE_NORMAL);
// 设置定位监听
aMap.setLocationSource(this);
// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
aMap.setMyLocationEnabled(true);
// 设置定位的类型为定位模式,有定位、跟随或地图根据面向方向旋转几种
aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
示例6: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geofence_new);
setTitle(R.string.polygonGeoFence);
// 初始化地理围栏
fenceClient = new GeoFenceClient(getApplicationContext());
btAddFence = (Button) findViewById(R.id.bt_addFence);
tvGuide = (TextView) findViewById(R.id.tv_guide);
tvResult = (TextView) findViewById(R.id.tv_result);
tvResult.setVisibility(View.GONE);
etCustomId = (EditText) findViewById(R.id.et_customId);
cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);
bitmap = BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW);
markerOption = new MarkerOptions().icon(bitmap).draggable(true);
init();
}
示例7: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.recorddisplay_activity);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);// 此方法必须重写
mGraspRadioButton = (RadioButton) findViewById(R.id.record_show_activity_grasp_radio_button);
mOriginRadioButton = (RadioButton) findViewById(R.id.record_show_activity_origin_radio_button);
mOriginRadioButton.setOnClickListener(this);
mGraspRadioButton.setOnClickListener(this);
mDisplaybtn = (ToggleButton) findViewById(R.id.displaybtn);
mDisplaybtn.setOnClickListener(this);
Intent recordIntent = getIntent();
int threadPoolSize = Runtime.getRuntime().availableProcessors() * 2 + 3;
mThreadPool = Executors.newFixedThreadPool(threadPoolSize);
if (recordIntent != null) {
mRecordItemId = recordIntent.getIntExtra(RecordActivity.RECORD_ID,
-1);
}
initMap();
}
示例8: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.route_activity);
/*
* 设置离线地图存储目录,在下载离线地图或初始化地图设置;
* 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
* 则需要在离线地图下载和使用地图页面都进行路径设置
* */
//Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
MapsInitializer.sdcardDir = OffLineMapUtils.getSdCacheDir(this);
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(bundle);// 此方法必须重写
init();
init_poi();
// deactivate();
}
示例9: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.shopmap_activity);
ManageActivityUtils.addActivity(this);
//如果安卓5.0设置状态栏为orange
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(getResources().getColor(R.color.orange));
}
//初始化各个控件ID
initID();
//先初始化mapview,是地图能正常显示出来
mapView = (MapView) this.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
//得到amap
aMap = mapView.getMap();
aMap.setLocationSource(this);// 设置定位监听
aMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
aMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
aMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
mUiSettings=aMap.getUiSettings();
mUiSettings.setZoomControlsEnabled(false);//隐藏放大按钮
}
示例10: init
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
private void init(Bundle savedInstanceState) {
mAddressTextView = (TextView) findViewById(R.id.address_text);
mDestinationButton = (Button) findViewById(R.id.destination_button);
mDestinationButton.setOnClickListener(this);
mMapView = (MapView) findViewById(R.id.map);
mMapView.onCreate(savedInstanceState);
mAmap = mMapView.getMap();
mAmap.getUiSettings().setZoomControlsEnabled(false);
mAmap.setOnMapLoadedListener(this);
mAmap.setOnCameraChangeListener(this);
mDestinationContainer = (LinearLayout) findViewById(R.id.destination_container);
mRouteCostText = (TextView) findViewById(R.id.routecost_text);
mDesitinationText = (TextView) findViewById(R.id.destination_text);
mDesitinationText.setOnClickListener(this);
mLocationImage = (ImageView) findViewById(R.id.location_image);
mLocationImage.setOnClickListener(this);
mFromToContainer = (LinearLayout) findViewById(R.id.fromto_container);
mCancelButton = (Button) findViewById(R.id.cancel_button);
}
示例11: onCreateView
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.transnode, container, false);
mapView = (MapView) rootView.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
mSearchView = (ImageView) rootView
.findViewById(R.id.action_searchAround);
mEditText = (EditText) rootView.findViewById(R.id.editText1);
mSearchView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
search(mEditText.getText().toString().trim());
}
});
setUpMap();
return rootView;
}
示例12: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multy_location);
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(savedInstanceState);// 此方法必须重写
mapView.getMap().setOnMapLoadedListener(this);
traceList = new ArrayList<LatLng>();
for (int i = 0; i < trace.length - 1; i++) {
LatLng mLatlng = new LatLng(trace[i], trace[++i]);
traceList.add(mLatlng);
}
init();
PolylineOptions po = new PolylineOptions();
po.color(Color.BLUE);
mapView.getMap().addPolyline(new PolylineOptions().addAll(traceList));
addMarker(traceList.get(0), "起点");
addMarker(traceList.get(traceList.size() - 1), "终点");
}
示例13: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarm);
mTextViewAlarmNotification = (TextView) findViewById(R.id.alarm_notification);
mTextViewPosition = (TextView) findViewById(R.id.position);
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(savedInstanceState);// 必须要写
init();
Bundle extras = getIntent().getExtras();
if (extras == null || !extras.containsKey(EXTRA_ID))
throw new IllegalStateException(
"You must put extra: EXTRA_ID(fell down alarm message's ID)");
long messageId = extras.getLong(EXTRA_ID);
new ShowUrgentMessage().execute(messageId);
}
示例14: onCreate
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.log_mapinfo_view);
/*
* 设置离线地图存储目录,在下载离线地图或初始化地图设置;
* 使用过程中可自行设置, 若自行设置了离线地图存储的路径,
* 则需要在离线地图下载和使用地图页面都进行路径设置
* */
//Demo中为了其他界面可以使用下载的离线地图,使用默认位置存储,屏蔽了自定义设置
// MapsInitializer.sdcardDir =OffLineMapUtils.getSdCacheDir(this);
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(savedInstanceState);// 此方法必须重写
init();
}
示例15: initMapView
import com.amap.api.maps.MapView; //导入方法依赖的package包/类
/**
* 初始化MapView
*
* @param v
* @param savedInstanceState
*/
private void initMapView(View v, Bundle savedInstanceState) {
mapView = (MapView) v.findViewById(R.id.map);
mapView.onCreate(savedInstanceState);
myLocation = new MyLocation();
mBuildingMarker = new BuildingMarker();
mVolunteerMarker = new VolunteerMarker();
myMapClick = new MyMapClick();
if (aMap == null) {
aMap = mapView.getMap();
aMap.moveCamera(CameraUpdateFactory.newCameraPosition(WHUS));
if (CURP == null) {
showLocationDialog();
myLocation.setUpMap();
}
}
}