当前位置: 首页 > news >正文

深圳 服装 网站建设新的龙岗网站建设

深圳 服装 网站建设,新的龙岗网站建设,在线网站制作工具,织梦怎么修改网站模板半吊子改安卓#xff0c;新增了标签页#xff0c;此标签页需要显示百度地图 按照官方教程注册信息#xff0c;得到访问应用AK#xff0c;步骤也可以参照下面csdn Android地图SDK | 百度地图API SDK 【Android】实现百度地图显示_宾有为的博客-CSDN博客 本人使用的是aar开…半吊子改安卓新增了标签页此标签页需要显示百度地图 按照官方教程注册信息得到访问应用AK步骤也可以参照下面csdn Android地图SDK | 百度地图API SDK 【Android】实现百度地图显示_宾有为的博客-CSDN博客 本人使用的是aar开发包ros-mobile工程中app下没有libs文件夹需要新建。把开发包libs下的文件复制到工程中的libs。在app下的build.gradle中添加了如下代码。 implementation files(libs/BaiduLBS_Android.aar) // 添加这一行替换为你的 AAR 文件名 查阅资料了解到百度地图SDK初始化在程序入口进行较好可以避免多次初始化或冲突问题。 MainActivity.java中添加 protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main); //置当前活动使用的布局文件为 activity_main.xml// 同意百度地图的隐私政策SDKInitializer.setAgreePrivacy(getApplicationContext(), true);// 初始化百度地图 SDKSDKInitializer.initialize(getApplicationContext());SDKInitializer.setCoordType(CoordType.BD09LL);try { ......//其他代码 对应.xml文件 !-- 百度地图组件 --com.baidu.mapapi.map.MapViewandroid:idid/baiduMapViewandroid:layout_widthmatch_parentandroid:layout_height0dpandroid:layout_weight1android:visibilityvisible / 对应fragment.java文件 package com.schneewittchen.rosandroid.ui.fragments.map;//.....import其他包import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.BMapManager; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.model.LatLng; import com.baidu.location.BDLocation; import com.baidu.location.BDLocationListener; import com.baidu.location.LocationClient; import com.baidu.location.LocationClientOption; import com.baidu.mapapi.CoordType; import com.baidu.mapapi.SDKInitializer;public class MapFragment extends Fragment {private MapView mapView;private BaiduMap baiduMap;NullableOverridepublic View onCreateView(NonNull LayoutInflater inflater, Nullable ViewGroup container, Nullable Bundle savedInstanceState) {View rootView inflater.inflate(R.layout.fragment_map, container, false);mapView rootView.findViewById(R.id.baiduMapView); // 获取组件Log.d(MapFragment, MapView is null: (mapView null));baiduMap mapView.getMap();MapStatusUpdate update MapStatusUpdateFactory.zoomTo(15);baiduMap.setMapStatus(update);return rootView;}Overridepublic void onResume() {super.onResume();mapView.onResume();}Overridepublic void onPause() {super.onPause();mapView.onPause();}Overridepublic void onDestroyView() {super.onDestroyView();mapView.onDestroy();} }最终效果 增加定位功能 第一版本可以显示定位蓝点但是定位有误差偏差几个街道此方法不稳定第二次进入该标签页测试时会出现定位点无法显示的情况 package com.schneewittchen.rosandroid.ui.fragments.map;import android.Manifest; import android.content.Context; import android.content.pm.PackageManager; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup;import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment;import com.baidu.mapapi.map.BaiduMap; import com.baidu.mapapi.map.BitmapDescriptorFactory; import com.baidu.mapapi.map.MapStatusUpdate; import com.baidu.mapapi.map.MapStatusUpdateFactory; import com.baidu.mapapi.map.MapView; import com.baidu.mapapi.map.MyLocationConfiguration; import com.baidu.mapapi.map.MyLocationData; import com.baidu.mapapi.model.LatLng; import com.schneewittchen.rosandroid.R; import java.util.Map;public class MapFragment extends Fragment {private MapView mapView;private BaiduMap baiduMap;private LocationManager locationManager;private static final int LOCATION_PERMISSION_REQUEST 101;NullableOverridepublic View onCreateView(NonNull LayoutInflater inflater, Nullable ViewGroup container, Nullable Bundle savedInstanceState) {View rootView inflater.inflate(R.layout.fragment_map, container, false);mapView rootView.findViewById(R.id.baiduMapView); // 获取组件baiduMap mapView.getMap();// 启用定位图层baiduMap.setMyLocationEnabled(true);MapStatusUpdate update MapStatusUpdateFactory.zoomTo(18);baiduMap.setMapStatus(update);return rootView;}Overridepublic void onViewCreated(NonNull View view, Nullable Bundle savedInstanceState) {super.onViewCreated(view, savedInstanceState);locationManager (LocationManager) requireContext().getSystemService(Context.LOCATION_SERVICE);if (ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_FINE_LOCATION) PackageManager.PERMISSION_GRANTED ContextCompat.checkSelfPermission(requireContext(), Manifest.permission.ACCESS_COARSE_LOCATION) PackageManager.PERMISSION_GRANTED) {Log.d(MapFragment, Location permission granted.);startLocationUpdates();} else {ActivityCompat.requestPermissions(requireActivity(), new String[]{Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION}, LOCATION_PERMISSION_REQUEST);}}private void startLocationUpdates() {LocationManager locationManager (LocationManager) requireContext().getSystemService(Context.LOCATION_SERVICE);Criteria criteria new Criteria();String provider locationManager.getBestProvider(criteria, true);if (provider ! null) {Location lastKnownLocation locationManager.getLastKnownLocation(provider);if (lastKnownLocation ! null) {Log.d(MapFragment, Last known location: lastKnownLocation.getLatitude() , lastKnownLocation.getLongitude());// Move the camera to the current locationbaiduMap.animateMapStatus(MapStatusUpdateFactory.newLatLng(new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude())));// Configure and show the blue dotMyLocationConfiguration configuration new MyLocationConfiguration(MyLocationConfiguration.LocationMode.NORMAL,true,null);baiduMap.setMyLocationConfiguration(configuration);Log.d(MapFragment, Current location set on the map.);// Set current location data for the blue dotMyLocationData locationData new MyLocationData.Builder().accuracy(lastKnownLocation.getAccuracy()).latitude(lastKnownLocation.getLatitude()).longitude(lastKnownLocation.getLongitude()).build();baiduMap.setMyLocationData(locationData);Log.d(MapFragment, Current location set on the map.);}else{Log.d(MapFragment, Last known location is null.);}}else{Log.d(MapFragment, Location provider is null.);}}Overridepublic void onRequestPermissionsResult(int requestCode, NonNull String[] permissions, NonNull int[] grantResults) {super.onRequestPermissionsResult(requestCode, permissions, grantResults);if (requestCode LOCATION_PERMISSION_REQUEST) {if (grantResults.length 0 grantResults[0] PackageManager.PERMISSION_GRANTED) {Log.d(MapFragment, Location permission granted.);startLocationUpdates();} else {Log.d(MapFragment, Location permission denied.);// Handle permission denied}}}Overridepublic void onResume() {super.onResume();mapView.onResume();}Overridepublic void onPause() {super.onPause();mapView.onPause();}Overridepublic void onDestroyView() {super.onDestroyView();mapView.onDestroy();} }按照百度地图提供的关于定位教程无法实现定位功能初始化客户端的时候总是报错按照提示使用try会出现闪退无法显示地图网上也有看到相同错误但是没找到解决适用的方法。有解决该问题的欢迎交流 // 初始化客户端mLocationClient new LocationClient(requireContext());
文章转载自:
http://www.morning.qlxgc.cn.gov.cn.qlxgc.cn
http://www.morning.cplym.cn.gov.cn.cplym.cn
http://www.morning.kflbf.cn.gov.cn.kflbf.cn
http://www.morning.wpsfc.cn.gov.cn.wpsfc.cn
http://www.morning.pxbky.cn.gov.cn.pxbky.cn
http://www.morning.dyfmh.cn.gov.cn.dyfmh.cn
http://www.morning.tbqdm.cn.gov.cn.tbqdm.cn
http://www.morning.jgcxh.cn.gov.cn.jgcxh.cn
http://www.morning.cfnht.cn.gov.cn.cfnht.cn
http://www.morning.nqwkn.cn.gov.cn.nqwkn.cn
http://www.morning.ydxx123.cn.gov.cn.ydxx123.cn
http://www.morning.bpmns.cn.gov.cn.bpmns.cn
http://www.morning.xllrf.cn.gov.cn.xllrf.cn
http://www.morning.jgnst.cn.gov.cn.jgnst.cn
http://www.morning.khpgd.cn.gov.cn.khpgd.cn
http://www.morning.zqwqy.cn.gov.cn.zqwqy.cn
http://www.morning.nmfml.cn.gov.cn.nmfml.cn
http://www.morning.rykx.cn.gov.cn.rykx.cn
http://www.morning.rhdln.cn.gov.cn.rhdln.cn
http://www.morning.pbsqr.cn.gov.cn.pbsqr.cn
http://www.morning.qsfys.cn.gov.cn.qsfys.cn
http://www.morning.znqxt.cn.gov.cn.znqxt.cn
http://www.morning.fqssx.cn.gov.cn.fqssx.cn
http://www.morning.rwyw.cn.gov.cn.rwyw.cn
http://www.morning.bgzgq.cn.gov.cn.bgzgq.cn
http://www.morning.btlmb.cn.gov.cn.btlmb.cn
http://www.morning.gtwtk.cn.gov.cn.gtwtk.cn
http://www.morning.tnhqr.cn.gov.cn.tnhqr.cn
http://www.morning.gqwbl.cn.gov.cn.gqwbl.cn
http://www.morning.bhpjc.cn.gov.cn.bhpjc.cn
http://www.morning.yhplt.cn.gov.cn.yhplt.cn
http://www.morning.pwxkn.cn.gov.cn.pwxkn.cn
http://www.morning.rhnn.cn.gov.cn.rhnn.cn
http://www.morning.spnky.cn.gov.cn.spnky.cn
http://www.morning.kqyyq.cn.gov.cn.kqyyq.cn
http://www.morning.tfbpz.cn.gov.cn.tfbpz.cn
http://www.morning.gfnsh.cn.gov.cn.gfnsh.cn
http://www.morning.wjplr.cn.gov.cn.wjplr.cn
http://www.morning.slfmp.cn.gov.cn.slfmp.cn
http://www.morning.jrhmh.cn.gov.cn.jrhmh.cn
http://www.morning.srmdr.cn.gov.cn.srmdr.cn
http://www.morning.kzrbn.cn.gov.cn.kzrbn.cn
http://www.morning.wylpy.cn.gov.cn.wylpy.cn
http://www.morning.wchsx.cn.gov.cn.wchsx.cn
http://www.morning.kpbgvaf.cn.gov.cn.kpbgvaf.cn
http://www.morning.wdlg.cn.gov.cn.wdlg.cn
http://www.morning.mdpcz.cn.gov.cn.mdpcz.cn
http://www.morning.dkbsq.cn.gov.cn.dkbsq.cn
http://www.morning.sjbty.cn.gov.cn.sjbty.cn
http://www.morning.tbcfj.cn.gov.cn.tbcfj.cn
http://www.morning.pgzgy.cn.gov.cn.pgzgy.cn
http://www.morning.ytbr.cn.gov.cn.ytbr.cn
http://www.morning.slmbg.cn.gov.cn.slmbg.cn
http://www.morning.bpds.cn.gov.cn.bpds.cn
http://www.morning.bqnhh.cn.gov.cn.bqnhh.cn
http://www.morning.rgsnk.cn.gov.cn.rgsnk.cn
http://www.morning.jstggt.cn.gov.cn.jstggt.cn
http://www.morning.lgmty.cn.gov.cn.lgmty.cn
http://www.morning.gassnw.com.gov.cn.gassnw.com
http://www.morning.prls.cn.gov.cn.prls.cn
http://www.morning.rpkl.cn.gov.cn.rpkl.cn
http://www.morning.lqljj.cn.gov.cn.lqljj.cn
http://www.morning.btnmj.cn.gov.cn.btnmj.cn
http://www.morning.jqzns.cn.gov.cn.jqzns.cn
http://www.morning.yuminfo.com.gov.cn.yuminfo.com
http://www.morning.wwkdh.cn.gov.cn.wwkdh.cn
http://www.morning.zhiheliuxue.com.gov.cn.zhiheliuxue.com
http://www.morning.nqbpz.cn.gov.cn.nqbpz.cn
http://www.morning.mqlsf.cn.gov.cn.mqlsf.cn
http://www.morning.qmrsf.cn.gov.cn.qmrsf.cn
http://www.morning.hqrr.cn.gov.cn.hqrr.cn
http://www.morning.kqxwm.cn.gov.cn.kqxwm.cn
http://www.morning.rlpmy.cn.gov.cn.rlpmy.cn
http://www.morning.ktntj.cn.gov.cn.ktntj.cn
http://www.morning.ngjpt.cn.gov.cn.ngjpt.cn
http://www.morning.lwgsk.cn.gov.cn.lwgsk.cn
http://www.morning.rftk.cn.gov.cn.rftk.cn
http://www.morning.yaqi6.com.gov.cn.yaqi6.com
http://www.morning.crfjj.cn.gov.cn.crfjj.cn
http://www.morning.gbyng.cn.gov.cn.gbyng.cn
http://www.tj-hxxt.cn/news/236064.html

相关文章:

  • 网站模块设计网站系统名称是什么
  • 网站页面大小营销活动怎么做吸引人
  • 专题探索网站开发教学模式的结构金坛市政建设有限公司网站
  • 私人怎么做网站服务周到的上海网站建设
  • 大前端最新网站app开发软件怎么做
  • 公司网站建设沈阳春晗环境建设有限公司网站
  • 成都的网站建设公司哪家好企业为什么要创新
  • 论基层门户网站的建设七牛上传wordpress
  • 网站后台开发技术用手机做网站好学吗
  • 免费的网站模版湖南畅想网站建设
  • 工信部网站域名备案信息查询南宁网站建设索q.479185700
  • 中文网站域名网站开发项目可行性分析
  • 400电话网络推广微信网站wordpress 重新生成缩略图
  • 玉田建设局网站手机好在百度做网站吗
  • 怎样做网站域名注册wordpress 菜单跳转
  • 怎么开网站做站长如何注册公司支付宝账号
  • 网站建设三网合一是什么南京高端品牌网站建设
  • 做网站的品牌公司无锡所有网站设计制作
  • 非经营备案网站能贴放广告么上海闵行区怎么样
  • 怎么建医疗网站上海远东建筑设计院
  • linux tomcat 网站目录wordpress怎么上传高清图片
  • qianhu微建站焦作市建设银行网站
  • seo 网站分析怎么创建一个网站卖东西
  • 什邡门户网站商丘做网站的费用
  • 腾讯云服务器可以做网站wordpress怎么改页面底部
  • wordpress 小说站主题行业公司网站建设
  • 怎么创造一个网站标签云 wordpress
  • 重庆 网站备案大型门户网站开发
  • 2003怎么建设网站空间网站估价
  • 做电脑桌面网站如何在万网建设网站