Android 百度地圖定時(shí)器軌跡回放,進(jìn)度條和播放順序

效果圖見連接:
https://img-blog.csdnimg.cn/20200703122714188.gif


TrackRecordActivity.class

public class TrackRecordActivity extends BaseFatherFragmentActivity implements

? ? ? ? BaiduMap.OnMapLoadedCallback,

? ? ? ? BaiduMap.OnMapStatusChangeListener,

? ? ? ? BaiduMap.OnMarkerClickListener,

? ? ? ? BaiduMap.OnMapClickListener {

? ? @BindView(R.id.tvTextTitle)

? ? TextView tvTextTitle;

? ? @BindView(R.id.btnTitleBack)

? ? ImageButton btnTitleBack;

? ? @BindView(R.id.baiduMap)

? ? MapView baiduMapView;

? ? @BindView(R.id.layoutBaidu)

? ? FrameLayout layoutBaidu;

? ? @BindView(R.id.view_control)

? ? View view_control;

? ? @BindView(R.id.iv_forward)

? ? ImageView iv_forward;

? ? @BindView(R.id.iv_play)

? ? ImageView iv_play;

? ? @BindView(R.id.iv_next)

? ? ImageView iv_next;

? ? @BindView(R.id.seekbar_play)

? ? SeekBar seekbar_play;

? ? @BindView(R.id.tv_mark_time)

? ? TextView tv_mark_time;

? ? private int playProgress;

? ? private BaiduMap baiduMap;

? ? private MyLocationListenner myListener = new MyLocationListenner();

? ? private LocationClient mLocClient;

? ? private BDLocation myLocation;

? ? private int mapFitZoom = 10;

? ? private String mDevCode;

? ? private String trackRecodeId;

? ? private List<Marker> markers;

? ? private boolean isPlayTrack = false;

? ? private LatLng playPosition = null;

? ? private List<HistoryLocationBean> historyLocationBeans = new ArrayList<>();

? ? private List<LatLng> routeList = new ArrayList<>();// 路線點(diǎn)的集合

? ? private int routeIndex;

? ? private boolean routeFlag;

? ? private final int ROUTE = 0;

? ? private Marker routeMarker;

? ? private int ROUTETIME = 500;

? ? private Handler mHandler = new Handler() {

? ? ? ? public void handleMessage(Message msg) {

? ? ? ? ? ? if (msg.what == ROUTE) {

? ? ? ? ? ? ? ? mHandler.sendEmptyMessage(PROGRESS);

? ? ? ? ? ? ? ? if (routeIndex == routeList.size() - 1) {

? ? ? ? ? ? ? ? ? ? isPlayTrack = false;

? ? ? ? ? ? ? ? ? ? routeFlag = false;

? ? ? ? ? ? ? ? ? ? iv_play.setImageResource(R.drawable.ic_player_start);

? ? ? ? ? ? ? ? ? ? AppLog.Loge("播放完畢");

? ? ? ? ? ? ? ? ? ? routeIndex = 0;

? ? ? ? ? ? ? ? ? ? if (routeMarker != null) {

? ? ? ? ? ? ? ? ? ? ? ? routeMarker.remove();

? ? ? ? ? ? ? ? ? ? ? ? routeMarker = null;

? ? ? ? ? ? ? ? ? ? }

//? ? ? ? ? ? ? ? ? ? addRouteLine(routeList);

? ? ? ? ? ? ? ? ? ? //畫路線

? ? ? ? ? ? ? ? ? ? if (routeList.size() > 0) {

? ? ? ? ? ? ? ? ? ? ? ? addMarker(routeList);

? ? ? ? ? ? ? ? ? ? }

//? ? ? ? ? ? ? ? ? ? drawMyRoute(routeList);

? ? ? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? if (routeIndex != 0) {

? ? ? ? ? ? ? ? ? ? isPlayTrack = true;

? ? ? ? ? ? ? ? ? ? //畫路線

? ? ? ? ? ? ? ? ? ? drawMyRoute(routeList.subList(0,

? ? ? ? ? ? ? ? ? ? ? ? ? ? routeIndex+1));

? ? ? ? ? ? ? ? ? ? //描點(diǎn)

? ? ? ? ? ? ? ? ? ? playPosition = routeList.get(routeList.size()-1);

? ? ? ? ? ? ? ? ? ? drawMapMarkView();

//? ? ? ? ? ? ? ? ? ? //描起點(diǎn)

? ? ? ? ? ? ? ? ? ? needAddMapMark(routeList.get(0),0);

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? // 頁面跟隨移動(dòng),注掉這行就是在原圖上繪制

//? ? ? ? ? ? ? ? moveToLocation(routeList.get(routeIndex), false);

? ? ? ? ? ? ? ? if (routeMarker == null) {

? ? ? ? ? ? ? ? ? ? Bitmap bitmap1= BitmapFactory.decodeResource(getResources(),R.drawable.track_run);

? ? ? ? ? ? ? ? ? ? BitmapDescriptor bitmap = BitmapDescriptorFactory.fromBitmap(AppUtils.imageScale(bitmap1,AppUtils.dp2Px(TrackRecordActivity.this,27),

? ? ? ? ? ? ? ? ? ? ? ? ? ? AppUtils.dp2Px(TrackRecordActivity.this,38)));

? ? ? ? ? ? ? ? ? ? //構(gòu)建MarkerOption,用于在地圖上添加Marker

? ? ? ? ? ? ? ? ? ? OverlayOptions option = new MarkerOptions()

? ? ? ? ? ? ? ? ? ? ? ? ? ? .position(routeList.get(routeIndex++))

? ? ? ? ? ? ? ? ? ? ? ? ? ? .icon(bitmap);

? ? ? ? ? ? ? ? ? ? //在地圖上添加Marker,并顯示

? ? ? ? ? ? ? ? ? ? routeMarker = (Marker) baiduMap.addOverlay(option);

? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? ? ? routeMarker.setPosition(routeList.get(routeIndex++));

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? routeMarker.setToTop();

? ? ? ? ? ? ? ? routeMarker.setDraggable(false);//設(shè)置 marker 是否允許拖拽,默認(rèn)不可拖拽

? ? ? ? ? ? ? ? routeMarker.setPerspective(false);//設(shè)置是否開啟 Marker 覆蓋物近大遠(yuǎn)小效果,默認(rèn)開啟

//? ? ? ? ? ? ? ? setUserMapCenter(routeList.get(routeIndex), mapFitZoom);

? ? ? ? ? ? ? ? mHandler.sendEmptyMessageDelayed(ROUTE, ROUTETIME);

? ? ? ? ? ? }

? ? ? ? ? ? if (msg.what == PROGRESS) {

? ? ? ? ? ? ? ? if (routeIndex == 0) {// 因?yàn)椴シ磐戤厱r(shí)routeIndex被賦值成了0,不寫進(jìn)度條會(huì)直接跳到0的位置

? ? ? ? ? ? ? ? ? ? setProgss(100);

? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? ? ? setProgss((routeIndex + 1) * 100 / routeList.size());

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? };

? ? };

? ? @Override

? ? protected void onCreate(Bundle savedInstanceState) {

? ? ? ? super.onCreate(savedInstanceState);

? ? ? ? setContentView(R.layout.ac_track_record);

? ? ? ? ButterKnife.bind(this);

? ? ? ? initVariable();

? ? ? ? setViews();

? ? ? ? setClick();

? ? ? ? initSeekBar();

? ? ? ? updatePlayMarkUi(false);

? ? ? ? getData();

? ? }

? ? @Override

? ? protected void onStart() {

? ? ? ? super.onStart();

? ? ? ? if (!mLocClient.isStarted()) {

? ? ? ? ? ? mLocClient.start();

? ? ? ? }

? ? }

? ? @Override

? ? protected void onStop() {

? ? ? ? super.onStop();

? ? ? ? mLocClient.stop();

? ? }

? ? private void initSeekBar() {

? ? ? ? seekbar_play.setMax(100);

? ? ? ? seekbar_play.setProgress(0);

? ? ? ? playProgress = seekbar_play.getProgress();

? ? ? ? seekbar_play.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onProgressChanged(SeekBar seekBar, int progress, boolean b) {

? ? ? ? ? ? ? ? playProgress = progress ;

? ? ? ? ? ? ? ? AppLog.Loge("移動(dòng)的進(jìn)度為:"+progress);

? ? ? ? ? ? ? ? if (!isPlayTrack){//播放過程中無效

? ? ? ? ? ? ? ? ? ? int selectIndex = 0;

? ? ? ? ? ? ? ? ? ? if(routeList!=null && routeList.size()>0){

? ? ? ? ? ? ? ? ? ? ? ? float seachPoi = (float) ((progress*routeList.size())/100.0);

? ? ? ? ? ? ? ? ? ? ? ? if((seachPoi-(int)seachPoi)>0.5){

? ? ? ? ? ? ? ? ? ? ? ? ? ? selectIndex = (int)seachPoi+1;

? ? ? ? ? ? ? ? ? ? ? ? }else{

? ? ? ? ? ? ? ? ? ? ? ? ? ? selectIndex = (int)seachPoi;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? //防止溢出

? ? ? ? ? ? ? ? ? ? ? ? if(selectIndex >= routeList.size()-1){

? ? ? ? ? ? ? ? ? ? ? ? ? ? selectIndex = routeList.size()-1;

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? routeIndex = selectIndex;

? ? ? ? ? ? ? ? ? ? AppLog.Loge("實(shí)際選擇的下標(biāo)為:"+routeIndex);

? ? ? ? ? ? ? ? ? ? //描點(diǎn)

? ? ? ? ? ? ? ? ? ? playPosition = routeList.get(selectIndex);

? ? ? ? ? ? ? ? ? ? drawMapMarkView();

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onStartTrackingTouch(SeekBar seekBar) {

? ? ? ? ? ? }

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onStopTrackingTouch(SeekBar seekBar) {

? ? ? ? ? ? }

? ? ? ? });

? ? }

? ? private void initVariable() {

? ? ? ? markers = new ArrayList<>();

? ? ? ? Intent intent = getIntent();

? ? ? ? if (null != intent) {

? ? ? ? ? ? mDevCode = intent.getStringExtra("device_code");

? ? ? ? ? ? trackRecodeId? = intent.getStringExtra("trackRecodeId");

? ? ? ? }

? ? }

? ? private void setViews() {

? ? ? ? tvTextTitle.setText(LangComm.getString("track_record"));

? ? ? ? setMapView();

? ? }

? ? private void setMapView() {

? ? ? ? //顯示控制放大縮小圖標(biāo)

? ? ? ? baiduMapView.showZoomControls(false);

? ? ? ? baiduMap = baiduMapView.getMap();

? ? ? ? // 開啟定位圖層

? ? ? ? baiduMap.setMyLocationEnabled(true);

? ? ? ? //設(shè)置事件

? ? ? ? baiduMap.setOnMapLoadedCallback(this);

? ? ? ? baiduMap.setOnMapClickListener(this);

? ? ? ? baiduMap.setOnMarkerClickListener(this);

? ? ? ? baiduMap.setOnMapStatusChangeListener(this);

? ? ? ? //百度個(gè)性化地圖

? ? ? ? if(AppUtils.getDarkModeStatus(mContext)){

? ? ? ? ? ? MapCustomType.setMapType(mContext,baiduMapView,true);

? ? ? ? }else{

? ? ? ? ? ? MapCustomType.setMapType(mContext,baiduMapView,false);

? ? ? ? }

? ? ? ? // 定位初始化

? ? ? ? mLocClient = new LocationClient(this.getApplicationContext());

? ? ? ? mLocClient.registerLocationListener(myListener);

? ? ? ? checkPermission();

? ? ? ? double[] doubles = GPSUtil.gps84_To_bd09(DataCenter.locationLat, DataCenter.locationLon);

? ? ? ? LatLng cenpt = new LatLng(doubles[0], doubles[1]);

? ? ? ? setUserMapCenter(cenpt, mapFitZoom);

? ? }

? ? private void setClick() {

? ? ? ? //返回

? ? ? ? btnTitleBack.setOnClickListener(new View.OnClickListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onClick(View v) {

? ? ? ? ? ? ? ? finish();

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? //前進(jìn)

? ? ? ? iv_forward.setOnClickListener(new View.OnClickListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onClick(View v) {

? ? ? ? ? ? ? ? if (isPlayTrack){

? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? forwardMark();

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? //后退

? ? ? ? iv_next.setOnClickListener(new View.OnClickListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onClick(View v) {

? ? ? ? ? ? ? ? if (isPlayTrack){

? ? ? ? ? ? ? ? ? ? return;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? nextMark();

? ? ? ? ? ? }

? ? ? ? });

? ? ? ? //播放

? ? ? ? iv_play.setOnClickListener(new View.OnClickListener() {

? ? ? ? ? ? @Override

? ? ? ? ? ? public void onClick(View v) {

? ? ? ? ? ? ? ? playMark();

? ? ? ? ? ? }

? ? ? ? });

? ? }

? ? private void forwardMark() {

? ? ? ? if(routeList.size()>0){

? ? ? ? ? ? LatLng info = null;

? ? ? ? ? ? if(routeIndex>0){

? ? ? ? ? ? ? ? routeIndex --;

? ? ? ? ? ? }else{

? ? ? ? ? ? ? ? routeIndex = routeList.size()-1;

? ? ? ? ? ? }

? ? ? ? ? ? info = routeList.get(routeIndex);

? ? ? ? ? ? playPosition = new LatLng(info.latitude,info.longitude);

? ? ? ? }

? ? ? ? drawMapMarkView();

? ? }

? ? private void nextMark() {

? ? ? ? if(routeList.size()>0){

? ? ? ? ? ? LatLng info = null;

? ? ? ? ? ? if(routeIndex < routeList.size()-1){

? ? ? ? ? ? ? ? routeIndex ++;

? ? ? ? ? ? }else{//重新回到第一個(gè)

? ? ? ? ? ? ? ? routeIndex = 0;

? ? ? ? ? ? }

? ? ? ? ? ? info = routeList.get(routeIndex);

? ? ? ? ? ? playPosition = new LatLng(info.latitude,info.longitude);

? ? ? ? }

? ? ? ? AppLog.Loge("繪制的點(diǎn)下標(biāo)為:"+routeIndex);

? ? ? ? drawMapMarkView();

? ? }

? ? private void playMark() {

? ? ? ? if (routeList == null || routeList.size() <= 0) {

? ? ? ? ? ? return;

? ? ? ? }

? ? ? ? routeFlag = !routeFlag;

? ? ? ? iv_play.setImageResource(routeFlag ? R.drawable.ic_player_pause

? ? ? ? ? ? ? ? : R.drawable.ic_player_start);

? ? ? ? isPlayTrack = routeFlag;

? ? ? ? if (routeFlag) {

? ? ? ? ? ? if (routeIndex == 0) {

? ? ? ? ? ? ? ? baiduMap.clear();

? ? ? ? ? ? ? ? routeMarker = null;

? ? ? ? ? ? }

? ? ? ? ? ? mHandler.sendEmptyMessageDelayed(ROUTE, 0);

? ? ? ? } else {

? ? ? ? ? ? mHandler.removeMessages(0);

? ? ? ? }

? ? }

? ? private void updatePlayMarkUi(boolean playStatus) {

? ? ? ? if(playStatus){

? ? ? ? ? ? iv_play.setImageResource(R.drawable.ic_player_pause);

? ? ? ? }else{

? ? ? ? ? ? iv_play.setImageResource(R.drawable.ic_player_start);

? ? ? ? }

? ? }

? ? //顯示或者是隱藏地圖操作選項(xiàng)

? ? private void showOrHideControl() {

? ? ? ? if (view_control.getVisibility() == View.VISIBLE) {

? ? ? ? ? ? AnimationUtils.showAndHiddenAnimation(view_control, AnimationUtils.AnimationState.STATE_HIDDEN_UP, 300);

? ? ? ? } else {

? ? ? ? ? ? AnimationUtils.showAndHiddenAnimation(view_control, AnimationUtils.AnimationState.STATE_SHOW_UP, 300);

? ? ? ? }

? ? ? ? baiduMap.hideInfoWindow();

? ? }

? ? /**

? ? * 設(shè)置中心點(diǎn)

? ? */

? ? private void setUserMapCenter(LatLng cenpt, int levle) {

//定義地圖狀態(tài)

? ? ? ? MapStatus mMapStatus = new MapStatus.Builder()

? ? ? ? ? ? ? ? .target(cenpt)

? ? ? ? ? ? ? ? .zoom(levle)

? ? ? ? ? ? ? ? .build();

//定義MapStatusUpdate對(duì)象,以便描述地圖狀態(tài)將要發(fā)生的變化

? ? ? ? MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);

//改變地圖狀態(tài)

? ? ? ? baiduMap.setMapStatus(mMapStatusUpdate);

? ? }

? ? @Override

? ? public void onMapClick(LatLng latLng) {

? ? ? ? showOrHideControl();

? ? }

? ? @Override

? ? public void onMapPoiClick(MapPoi mapPoi) {

? ? }

? ? @Override

? ? public void onMapLoaded() {

? ? }

? ? @Override

? ? public void onMapStatusChangeStart(MapStatus mapStatus) {

? ? }

? ? @Override

? ? public void onMapStatusChangeStart(MapStatus mapStatus, int i) {

? ? }

? ? @Override

? ? public void onMapStatusChange(MapStatus mapStatus) {

? ? }

? ? @Override

? ? public void onMapStatusChangeFinish(MapStatus mapStatus) {

? ? }

? ? @Override

? ? public boolean onMarkerClick(Marker marker) {

? ? ? ? //正在播放軌跡,不能點(diǎn)擊

? ? ? ? if (isPlayTrack){

? ? ? ? ? ? showInfoWindow(marker);

? ? ? ? }

? ? ? ? return false;

? ? }

? ? private void showInfoWindow(Marker marker) {

? ? ? ? View view = View.inflate(this, R.layout.lay_map_info_window, null);

? ? ? ? TextView textView = view.findViewById(R.id.item_history_time);

? ? ? ? Bundle bundle = marker.getExtraInfo();

? ? ? ? String time = bundle.getString("time");

? ? ? ? if (null != bundle && !StringUtils.isEmpty(time)) {

? ? ? ? ? ? textView.setVisibility(View.VISIBLE);

? ? ? ? ? ? textView.setText(time);

? ? ? ? }

? ? ? ? final InfoWindow mInfoWindow = new InfoWindow(view, marker.getPosition(), -47);

? ? ? ? baiduMap.showInfoWindow(mInfoWindow);

? ? ? ? //記錄,當(dāng)前點(diǎn)擊的下標(biāo)

? ? ? ? if(historyLocationBeans.size()>0){

? ? ? ? ? ? for (int i = 0; i < historyLocationBeans.size(); i++) {

? ? ? ? ? ? ? ? if(!StringUtils.isEmpty(time) && time.equals(historyLocationBeans.get(i).getTime())){

? ? ? ? ? ? ? ? ? ? routeIndex = i;

? ? ? ? ? ? ? ? ? ? break;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? }

? ? }

? ? /**

? ? * @description 定位SDK監(jiān)聽函數(shù)

? ? * @remark

? ? */

? ? public class MyLocationListenner implements BDLocationListener {

? ? ? ? /**

? ? ? ? * @param location  定位位置

? ? ? ? * @description 收到定位后處理

? ? ? ? * @remark

? ? ? ? */

? ? ? ? @Override

? ? ? ? public void onReceiveLocation(BDLocation location) {

? ? ? ? ? ? // map view 銷毀后不在處理新接收的位置

? ? ? ? ? ? if (location == null || baiduMap == null) {

? ? ? ? ? ? ? ? return;

? ? ? ? ? ? }

? ? ? ? ? ? switch (location.getLocType()) {

? ? ? ? ? ? ? ? case BDLocation.TypeCriteriaException:

? ? ? ? ? ? ? ? case BDLocation.TypeNetWorkException:

? ? ? ? ? ? ? ? case BDLocation.TypeNone:

? ? ? ? ? ? ? ? case BDLocation.TypeOffLineLocationFail:

? ? ? ? ? ? ? ? case BDLocation.TypeServerError:

? ? ? ? ? ? ? ? case BDLocation.TypeServerCheckKeyError:

? ? ? ? ? ? ? ? case BDLocation.TypeOffLineLocationNetworkFail:

? ? ? ? ? ? ? ? case BDLocation.TypeServerDecryptError:

? ? ? ? ? ? ? ? ? ? break;

? ? ? ? ? ? ? ? default://定位方式正確的時(shí)候

? ? ? ? ? ? ? ? ? ? AppLog.Loge("當(dāng)前我的位置,緯度:" + location.getLatitude() + "--經(jīng)度:" + location.getLongitude() + "---定位方式:" + location.getLocType());

? ? ? ? ? ? ? ? ? ? myLocation = location;

? ? ? ? ? ? ? ? ? ? double[] doubles = GPSUtil.bd09_To_gps84(location.getLatitude(), location.getLongitude());

? ? ? ? ? ? ? ? ? ? DataCenter.locationLat = doubles[0];

? ? ? ? ? ? ? ? ? ? DataCenter.locationLon = doubles[1];

? ? ? ? ? ? ? ? ? ? break;

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? public void onReceivePoi(BDLocation poiLocation) {

? ? ? ? }

? ? }

? ? /**

? ? * @description 查詢是否已有定位和存儲(chǔ)權(quán)限

? ? * @remark

? ? */

? ? private int grantedCount = 0;

? ? private void checkPermission() {

? ? ? ? final String strPer[] = {

? ? ? ? ? ? ? ? Manifest.permission.ACCESS_COARSE_LOCATION

? ? ? ? };

? ? ? ? grantedCount = 0;

? ? ? ? final RxPermissions rxPermissions = new RxPermissions(this);

? ? ? ? rxPermissions.requestEach(strPer)

? ? ? ? ? ? ? ? .subscribe(new Consumer<Permission>() {

? ? ? ? ? ? ? ? ? ? @Override

? ? ? ? ? ? ? ? ? ? public void accept(Permission permission) {

? ? ? ? ? ? ? ? ? ? ? ? if (permission.granted) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? grantedCount++;

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (grantedCount == strPer.length) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //請(qǐng)求成功操作

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? LocationClientOption option = new LocationClientOption();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? option.setOpenGps(true); // 打開gps

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? option.setCoorType("bd09ll"); // 設(shè)置坐標(biāo)類型

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? option.setScanSpan(120 * 1000);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? option.setNeedDeviceDirect(true);//在網(wǎng)絡(luò)定位時(shí),是否需要設(shè)備方向- true:需要 ; false:不需要。默認(rèn)為false

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mLocClient.setLocOption(option);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mLocClient.start();

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? } else if (permission.shouldShowRequestPermissionRationale) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ShowPermissionDialog(LangComm.getString("location_author"));

? ? ? ? ? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ShowPermissionDialog(LangComm.getString("android_check_permissions"));

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? });

? ? }

? ? private PermissionDialog mPermissionDialog = null;

? ? private void ShowPermissionDialog(String strMsg) {

? ? ? ? if (mPermissionDialog == null) {

? ? ? ? ? ? mPermissionDialog = new PermissionDialog(this);

? ? ? ? }

? ? ? ? if (mPermissionDialog.mDialog != null && !mPermissionDialog.mDialog.isShowing()) {

? ? ? ? ? ? mPermissionDialog.showPermissDialog(LangComm.getString("tips"), strMsg,

? ? ? ? ? ? ? ? ? ? LangComm.getString("confirm"), null);

? ? ? ? }

? ? }

? ? private void getData() {

//? ? ? ? mProgressDialog.showProgress(LangComm.getString("loading"));

//? ? ? ? CollarBiz.getLocationHistory(device_code, startTime + "", endTime + "",

//? ? ? ? ? ? ? ? AppUtils.getUserToken(TrackRecordActivity.this),

//? ? ? ? ? ? ? ? new MyNetBack() {

//? ? ? ? ? ? ? ? ? ? @Override

//? ? ? ? ? ? ? ? ? ? public boolean onFail(int iStatus, String msg) {

//? ? ? ? ? ? ? ? ? ? ? ? HttpToast.ToastDefault(TrackRecordActivity.this, iStatus, msg);

//? ? ? ? ? ? ? ? ? ? ? ? mProgressDialog.dismiss();

//? ? ? ? ? ? ? ? ? ? ? ? return false;

//? ? ? ? ? ? ? ? ? ? }

//

//? ? ? ? ? ? ? ? ? ? @Override

//? ? ? ? ? ? ? ? ? ? public void onSuccess(Object object) {

//? ? ? ? ? ? ? ? ? ? ? ? mProgressDialog.dismiss();

//? ? ? ? ? ? ? ? ? ? ? ? List<HistoryLocationBean> historyLocationBeans = (List<HistoryLocationBean>) object;

//? ? ? ? ? ? ? ? ? ? ? ? setDataToMap(historyLocationBeans);

//? ? ? ? ? ? ? ? ? ? }

//? ? ? ? ? ? ? ? });

? ? ? ? if(historyLocationBeans!=null){

? ? ? ? ? ? historyLocationBeans.clear();

? ? ? ? }

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.11245,22.896382,AppUtils.getNowTime()+1));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.22245,22.836382,AppUtils.getNowTime()+2));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.33245,22.796382,AppUtils.getNowTime()+3));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.41245,22.696382,AppUtils.getNowTime()+4));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.51245,22.546382,AppUtils.getNowTime()+5));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.61245,22.556382,AppUtils.getNowTime()+6));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.71245,23.696382,AppUtils.getNowTime()+7));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.87245,24.756382,AppUtils.getNowTime()+8));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.91245,22.866382,AppUtils.getNowTime()+9));

? ? ? ? historyLocationBeans.add(new HistoryLocationBean(mDevCode,113.11245,21.986382,AppUtils.getNowTime()+10));

? ? ? ? //先移除地圖所有的標(biāo)注

? ? ? ? baiduMap.clear();

? ? ? ? setDataToMap(historyLocationBeans);

? ? ? ? if(historyLocationBeans!=null && historyLocationBeans.size()>0){

? ? ? ? ? ? //如果有軌跡設(shè)置地圖中心點(diǎn)為第一個(gè)坐標(biāo)

? ? ? ? ? ? double lat = (historyLocationBeans.get(historyLocationBeans.size()-1).getLat()+historyLocationBeans.get(0).getLat())/2;

? ? ? ? ? ? double log = (historyLocationBeans.get(historyLocationBeans.size()-1).getLon()+historyLocationBeans.get(0).getLon())/2;

? ? ? ? ? ? double dbLoction[] = GPSUtil.gps84_To_bd09(lat, log);

? ? ? ? ? ? LatLng point_center = new LatLng(dbLoction[0], dbLoction[1]);

? ? ? ? ? ? setUserMapCenter(point_center, mapFitZoom);

? ? ? ? }

? ? }

? ? SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");

? ? private void setDataToMap(List<HistoryLocationBean> historyLocationBeans) {

? ? ? ? /**

? ? ? ? * 添加marker

? ? ? ? */

? ? ? ? if (routeList!=null){

? ? ? ? ? ? routeList.clear();

? ? ? ? }

? ? ? ? if (null != historyLocationBeans && historyLocationBeans.size() > 0) {

? ? ? ? ? ? for (int i = 0; i < historyLocationBeans.size(); i++) {

? ? ? ? ? ? ? ? double lat = historyLocationBeans.get(i).getLat();

? ? ? ? ? ? ? ? double log = historyLocationBeans.get(i).getLon();

? ? ? ? ? ? ? ? double dbLoction[] = GPSUtil.gps84_To_bd09(lat, log);

? ? ? ? ? ? ? ? String time = dateFormat.format(historyLocationBeans.get(i).getTime());

? ? ? ? ? ? ? ? LatLng latLng = new LatLng(dbLoction[0], dbLoction[1]);

? ? ? ? ? ? ? ? routeList.add(latLng);

? ? ? ? ? ? }

? ? ? ? }else {

? ? ? ? ? ? ToastView.bottomShow(TrackRecordActivity.this,LangComm.getString("no_data"), Toast.LENGTH_SHORT);

? ? ? ? }

? ? ? ? if (routeList.size() > 0) {

? ? ? ? ? addMarker(routeList);

? ? ? ? }

? ? }

? ? private void addMarker(List<LatLng> list_line) {

? ? ? ? new Thread(

? ? ? ? ? ? ? ? new Runnable() {

? ? ? ? ? ? ? ? ? ? @Override

? ? ? ? ? ? ? ? ? ? public void run() {

? ? ? ? ? ? ? ? ? ? ? ? AppLog.Loge("points", list_line.size() + "");

? ? ? ? ? ? ? ? ? ? ? ? markers.clear();

? ? ? ? ? ? ? ? ? ? ? ? //畫路線

? ? ? ? ? ? ? ? ? ? ? ? drawMyRoute(list_line);

? ? ? ? ? ? ? ? ? ? ? ? routeList = list_line;

? ? ? ? ? ? ? ? ? ? ? ? boolean isFactory=false;

? ? ? ? ? ? ? ? ? ? ? ? BitmapDescriptor bitmap = null;

? ? ? ? ? ? ? ? ? ? ? ? //描繪軌跡上的點(diǎn)

? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < list_line.size(); i++) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? //定義Maker坐標(biāo)點(diǎn)

? ? ? ? ? ? ? ? ? ? ? ? ? ? LatLng point = list_line.get(i);

? ? ? ? ? ? ? ? ? ? ? ? ? ? //構(gòu)建Marker圖標(biāo)

? ? ? ? ? ? ? ? ? ? ? ? ? ? if (i == 0) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? isFactory=false;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //起點(diǎn)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? needAddMapMark(point,0);

? ? ? ? ? ? ? ? ? ? ? ? ? ? } else if (i == list_line.size() - 1) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //終點(diǎn)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? needAddMapMark(point,1);

? ? ? ? ? ? ? ? ? ? ? ? ? ? } else {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if(!isFactory){

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? bitmap = BitmapDescriptorFactory

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? .fromResource(R.drawable.mark_record1);

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? }

? ? ? ? ).start();

? ? }

? ? private void needAddMapMark(LatLng point,int position) {

? ? ? ? BitmapDescriptor bitmap = null;

? ? ? ? if(position == 0){

? ? ? ? ? ? Bitmap bitmap1= BitmapFactory.decodeResource(getResources(),R.drawable.track_start);

? ? ? ? ? ? bitmap =BitmapDescriptorFactory

? ? ? ? ? ? ? ? ? ? .fromBitmap(AppUtils.imageScale(bitmap1,AppUtils.dp2Px(TrackRecordActivity.this,20),

? ? ? ? ? ? ? ? ? ? ? ? ? ? AppUtils.dp2Px(TrackRecordActivity.this,32)));

? ? ? ? }else{

? ? ? ? ? ? Bitmap bitmap1= BitmapFactory.decodeResource(getResources(),R.drawable.track_end);

? ? ? ? ? ? bitmap = BitmapDescriptorFactory

? ? ? ? ? ? ? ? ? ? .fromBitmap(AppUtils.imageScale(bitmap1,AppUtils.dp2Px(TrackRecordActivity.this,20),

? ? ? ? ? ? ? ? ? ? ? ? ? ? AppUtils.dp2Px(TrackRecordActivity.this,32)));

? ? ? ? }

? ? ? ? Bundle bundleInfo = new Bundle();

//? ? ? ? bundleInfo.putString("time", list.get(i).getTime());

? ? ? ? //構(gòu)建MarkerOption,用于在地圖上添加Marker

? ? ? ? OverlayOptions option = new MarkerOptions()

? ? ? ? ? ? ? ? .position(point)

? ? ? ? ? ? ? ? .extraInfo(bundleInfo)

? ? ? ? ? ? ? ? .icon(bitmap);

? ? ? ? //在地圖上添加Marker,并顯示

? ? ? ? Marker marker = (Marker) baiduMap.addOverlay(option);

? ? ? ? markers.add(marker);

? ? ? ? marker.setDraggable(false);//設(shè)置 marker 是否允許拖拽,默認(rèn)不可拖拽

? ? ? ? marker.setPerspective(false);//設(shè)置是否開啟 Marker 覆蓋物近大遠(yuǎn)小效果,默認(rèn)開啟

? ? }

? ? private Overlay overlay;

? ? //4.畫軌跡方法

? ? /**

? ? * 添加路線

? ? *

? ? * @param points2

? ? */

? ? protected void drawMyRoute(List<LatLng> points2) {

? ? ? ? if (points2.size() == 0) {

? ? ? ? ? ? return;

? ? ? ? }

? ? ? ? if (null != overlay) {

? ? ? ? ? ? overlay.remove();

? ? ? ? }

? ? ? ? //添加紋理圖片

? ? ? ? List<BitmapDescriptor> textureList = new ArrayList<BitmapDescriptor>();

? ? ? ? BitmapDescriptor mRedTexture = BitmapDescriptorFactory

? ? ? ? ? ? ? ? .fromAsset("icon_red_road.png");//箭頭圖片

? ? ? ? textureList.add(mRedTexture);

? ? ? ? // 添加紋理圖片對(duì)應(yīng)的順序

? ? ? ? List<Integer> textureIndexs = new ArrayList<Integer>();

? ? ? ? for (int i = 0; i < points2.size() - 1; i++) {

? ? ? ? ? ? textureIndexs.add(0);

? ? ? ? }

? ? ? ? OverlayOptions options = new PolylineOptions()

? ? ? ? ? ? ? ? .textureIndex(textureIndexs)//設(shè)置分段紋理index數(shù)組

? ? ? ? ? ? ? ? .customTextureList(textureList)//設(shè)置線段的紋理,建議紋理資源長(zhǎng)寬均為2的n次方

? ? ? ? ? ? ? ? .dottedLine(true)

? ? ? ? ? ? ? ? .color(getResources().getColor(R.color.app_khaki))

? ? ? ? ? ? ? ? .width(15)

? ? ? ? ? ? ? ? .points(points2);

? ? ? ? overlay = baiduMap.addOverlay(options);

? ? }

? ? private void drawMapMarkView(){

? ? ? ? if(playPosition!=null){

? ? ? ? ? ? if(routeMarker == null){

? ? ? ? ? ? ? ? Bitmap bitmap1= BitmapFactory.decodeResource(getResources(),R.drawable.track_run);

? ? ? ? ? ? ? ? BitmapDescriptor bitmap = BitmapDescriptorFactory.fromBitmap(AppUtils.imageScale(bitmap1,AppUtils.dp2Px(TrackRecordActivity.this,27),

? ? ? ? ? ? ? ? ? ? ? ? AppUtils.dp2Px(TrackRecordActivity.this,38)));

? ? ? ? ? ? ? ? //構(gòu)建MarkerOption,用于在地圖上添加Marker

? ? ? ? ? ? ? ? OverlayOptions option = new MarkerOptions()

? ? ? ? ? ? ? ? ? ? ? ? .position(playPosition)

? ? ? ? ? ? ? ? ? ? ? ? .icon(bitmap);

? ? ? ? ? ? ? ? //在地圖上添加Marker,并顯示

? ? ? ? ? ? ? ? routeMarker = (Marker) baiduMap.addOverlay(option);

? ? ? ? ? ? }else{

? ? ? ? ? ? ? ? routeMarker.setPosition(playPosition);

? ? ? ? ? ? ? ? routeMarker.startAnimation();

? ? ? ? ? ? }

? ? ? ? ? ? routeMarker.setToTop();

? ? ? ? ? ? routeMarker.setDraggable(false);//設(shè)置 marker 是否允許拖拽,默認(rèn)不可拖拽

? ? ? ? ? ? routeMarker.setPerspective(false);//設(shè)置是否開啟 Marker 覆蓋物近大遠(yuǎn)小效果,默認(rèn)開啟

? ? ? ? }

? ? ? ? setUserMapCenter(playPosition, mapFitZoom);

? ? ? ? //時(shí)間變化

? ? ? ? if(historyLocationBeans!=null && historyLocationBeans.size()>0){

? ? ? ? ? ? tv_mark_time.setText(AppUtils.timeDate(historyLocationBeans.get(routeIndex).getTime()));

? ? ? ? }

? ? }

? ? @Override

? ? protected void onDestroy() {

? ? ? ? super.onDestroy();

? ? }

? ? private void setProgss(int index) {

? ? ? ? seekbar_play.setProgress(index);

? ? }

? ? private final static int PROGRESS = 1234;

? ? /**

? ? * 移動(dòng)到指定位置 并縮放

? ? *

? ? * @param latlng

? ? */

? ? private void moveToLocation(LatLng latlng, boolean flag) {

? ? ? ? MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(latlng);// 設(shè)置新的中心點(diǎn)

? ? ? ? baiduMap.animateMapStatus(u);

? ? ? ? if (flag && baiduMap.getMapStatus().zoom < 12.0f) {

? ? ? ? ? ? // 加個(gè)延時(shí)播放的效果,就可以有先平移 ,再縮放的效果

? ? ? ? ? ? mTimer.start();

? ? ? ? }

? ? }

? ? private CountDownTimer mTimer = new CountDownTimer(2000, 2000) {

? ? ? ? @Override

? ? ? ? public void onTick(long millisUntilFinished) {

? ? ? ? }

? ? ? ? @Override

? ? ? ? public void onFinish() {

? ? ? ? ? ? if (baiduMap != null) {

? ? ? ? ? ? ? ? MapStatusUpdate u1 = MapStatusUpdateFactory.zoomTo(12.0f);

? ? ? ? ? ? ? ? baiduMap.animateMapStatus(u1);

? ? ? ? ? ? }

? ? ? ? }

? ? };

}

HistoryLocationBean.class

public class HistoryLocationBean {

? ? /**

? ? *? "data":[{

? ? "deviceCode": "xxxx",

? ? "lon": 113.11111,

? ? "lat": 23.11111,

? ? "time": 1231231231, //時(shí)間戳毫秒數(shù)

? ? "type": "gps"

? ? },{

? ? "deviceCode": "xxxx",

? ? "lon": 113.11111,

? ? "lat": 23.11111,

? ? "time": 1231231231, //時(shí)間戳毫秒數(shù)

? ? "type": "gps"

? ? },{

? ? "deviceCode": "xxxx",

? ? "lon": 113.11111,

? ? "lat": 23.11111,

? ? "time": 1231231231, //時(shí)間戳毫秒數(shù)

? ? "type": "gps"

? ? }]

? ? */

? ? private String deviceCode;

? ? private double lon;

? ? private double lat;

? ? private long? time;

? ? private String gps;

? ? public HistoryLocationBean() { }

? ? public HistoryLocationBean(String deviceCode, double lon, double lat, long time) {

? ? ? ? this.deviceCode = deviceCode;

? ? ? ? this.lon = lon;

? ? ? ? this.lat = lat;

? ? ? ? this.time = time;

? ? }

? ? public String getDeviceCode() {

? ? ? ? return deviceCode;

? ? }

? ? public void setDeviceCode(String deviceCode) {

? ? ? ? this.deviceCode = deviceCode;

? ? }

? ? public double getLon() {

? ? ? ? return lon;

? ? }

? ? public void setLon(double lon) {

? ? ? ? this.lon = lon;

? ? }

? ? public double getLat() {

? ? ? ? return lat;

? ? }

? ? public void setLat(double lat) {

? ? ? ? this.lat = lat;

? ? }

? ? public long getTime() {

? ? ? ? return time;

? ? }

? ? public void setTime(long time) {

? ? ? ? this.time = time;

? ? }

? ? public String getGps() {

? ? ? ? return gps;

? ? }

? ? public void setGps(String gps) {

? ? ? ? this.gps = gps;

? ? }

}

布局文件ac_track_record.xml

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

? ? xmlns:app="http://schemas.android.com/apk/res-auto"

? ? xmlns:tools="http://schemas.android.com/tools"

? ? android:layout_width="match_parent"

? ? android:layout_height="match_parent"

? ? android:id="@+id/linear_mark"

? ? android:orientation="vertical">

? ? <include layout="@layout/layout_title_bar" />

? ? <RelativeLayout

? ? ? ? android:layout_width="match_parent"

? ? ? ? android:layout_height="match_parent">

? ? ? ? <FrameLayout

? ? ? ? ? ? android:id="@+id/layoutGoogle"

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="match_parent"

? ? ? ? ? ? android:visibility="gone">

? ? ? ? ? ? <fragment

? ? ? ? ? ? ? ? android:id="@+id/googleMap"

? ? ? ? ? ? ? ? class="com.google.android.gms.maps.SupportMapFragment"

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="match_parent" />

? ? ? ? </FrameLayout>

? ? ? ? <FrameLayout

? ? ? ? ? ? android:id="@+id/layoutBaidu"

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="match_parent"

? ? ? ? ? ? >

? ? ? ? ? ? <com.baidu.mapapi.map.MapView

? ? ? ? ? ? ? ? android:id="@+id/baiduMap"

? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? android:layout_height="match_parent"

? ? ? ? ? ? ? ? android:clickable="true" />

? ? ? ? </FrameLayout>

? ? ? ? <LinearLayout

? ? ? ? ? ? android:id="@+id/view_control"

? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? android:layout_height="90dp"

? ? ? ? ? ? android:gravity="center_vertical"

? ? ? ? ? ? android:background="@color/normal_color"

? ? ? ? ? ? android:layout_alignParentBottom="true">

? ? ? ? ? ? <ImageView

? ? ? ? ? ? ? ? android:id="@+id/iv_forward"

? ? ? ? ? ? ? ? android:layout_width="45dp"

? ? ? ? ? ? ? ? android:layout_height="45dp"

? ? ? ? ? ? ? ? android:padding="10dp"

? ? ? ? ? ? ? ? android:layout_marginStart="@dimen/margin15"

? ? ? ? ? ? ? ? android:src="@drawable/ic_track_forward"/>

? ? ? ? ? ? <RelativeLayout

? ? ? ? ? ? ? ? android:layout_width="0dp"

? ? ? ? ? ? ? ? android:layout_weight="1"

? ? ? ? ? ? ? ? android:gravity="center_vertical"

? ? ? ? ? ? ? ? android:layout_height="match_parent">

? ? ? ? ? ? ? ? <LinearLayout

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_centerInParent="true"

? ? ? ? ? ? ? ? ? ? android:gravity="center_vertical"

? ? ? ? ? ? ? ? ? ? android:orientation="vertical">

? ? ? ? ? ? ? ? <SeekBar

? ? ? ? ? ? ? ? ? ? android:id="@+id/seekbar_play"

? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"

? ? ? ? ? ? ? ? ? ? android:layout_height="30dp"

? ? ? ? ? ? ? ? ? ? android:layout_centerHorizontal="true"

? ? ? ? ? ? ? ? ? ? android:layout_marginEnd="10dp"

? ? ? ? ? ? ? ? ? ? android:layout_marginStart="10dp"

? ? ? ? ? ? ? ? ? ? android:paddingEnd="10dp"

? ? ? ? ? ? ? ? ? ? android:paddingBottom="5dp"

? ? ? ? ? ? ? ? ? ? android:paddingStart="10dp"

? ? ? ? ? ? ? ? ? ? android:paddingTop="3dp"

? ? ? ? ? ? ? ? ? ? android:progress="0"

? ? ? ? ? ? ? ? ? ? android:progressDrawable="@drawable/track_bg_bar_thumb"

? ? ? ? ? ? ? ? ? ? android:thumb="@drawable/badge_blue_small"

? ? ? ? ? ? ? ? ? ? android:thumbOffset="0dip" />

? ? ? ? ? ? ? ? <TextView

? ? ? ? ? ? ? ? ? ? android:id="@+id/tv_mark_time"

? ? ? ? ? ? ? ? ? ? android:layout_width="wrap_content"

? ? ? ? ? ? ? ? ? ? android:layout_height="wrap_content"

? ? ? ? ? ? ? ? ? ? android:textSize="@dimen/text16"

? ? ? ? ? ? ? ? ? ? android:layout_marginTop="5dp"

? ? ? ? ? ? ? ? ? ? android:layout_gravity="center_horizontal"

? ? ? ? ? ? ? ? ? ? android:textColor="@color/app_black_color"

? ? ? ? ? ? ? ? ? ? android:text="@string/test"/>

? ? ? ? ? ? ? ? </LinearLayout>

? ? ? ? ? ? ? ? <ImageView

? ? ? ? ? ? ? ? ? ? android:id="@+id/iv_play"

? ? ? ? ? ? ? ? ? ? android:layout_width="45dp"

? ? ? ? ? ? ? ? ? ? android:layout_height="45dp"

? ? ? ? ? ? ? ? ? ? android:padding="10dp"

? ? ? ? ? ? ? ? ? ? android:layout_alignParentBottom="true"

? ? ? ? ? ? ? ? ? ? android:layout_marginStart="@dimen/margin15"

? ? ? ? ? ? ? ? ? ? android:background="@drawable/corners_gray"

? ? ? ? ? ? ? ? ? ? android:src="@drawable/ic_player_start"/>

? ? ? ? ? ? </RelativeLayout>

? ? ? ? ? ? <ImageView

? ? ? ? ? ? ? ? android:id="@+id/iv_next"

? ? ? ? ? ? ? ? android:layout_width="45dp"

? ? ? ? ? ? ? ? android:layout_height="45dp"

? ? ? ? ? ? ? ? android:padding="10dp"

? ? ? ? ? ? ? ? android:layout_marginEnd="@dimen/margin15"

? ? ? ? ? ? ? ? android:src="@drawable/ic_track_next"/>

? ? ? ? </LinearLayout>

? ? </RelativeLayout>

</LinearLayout>



ic_player_start

ic_player_pause

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容