Android 百度地圖定時器軌跡回放夫偶,進(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);

? ? ? ? ? ? ? ? }

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

//? ? ? ? ? ? ? ? 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)椴シ磐戤厱rrouteIndex被賦值成了0泣矛,不寫進(jìn)度條會直接跳到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("移動的進(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);

? ? ? ? //百度個性化地圖

? ? ? ? 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{//重新回到第一個

? ? ? ? ? ? ? ? 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對象躺坟,以便描述地圖狀態(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://定位方式正確的時候

? ? ? ? ? ? ? ? ? ? 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 查詢是否已有定位和存儲權(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) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //請求成功操作

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 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è)備方向- 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)為第一個坐標(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);

? ? ? ? // 添加紋理圖片對應(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è)置線段的紋理,建議紋理資源長寬均為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);

? ? ? ? //時間變化

? ? ? ? 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;

? ? /**

? ? * 移動到指定位置 并縮放

? ? *

? ? * @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) {

? ? ? ? ? ? // 加個延時播放的效果,就可以有先平移 棺妓,再縮放的效果

? ? ? ? ? ? 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ù)

? ? "type": "gps"

? ? },{

? ? "deviceCode": "xxxx",

? ? "lon": 113.11111,

? ? "lat": 23.11111,

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

? ? "type": "gps"

? ? },{

? ? "deviceCode": "xxxx",

? ? "lon": 113.11111,

? ? "lat": 23.11111,

? ? "time": 1231231231, //時間戳毫秒數(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)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市炮赦,隨后出現(xiàn)的幾起案子怜跑,更是在濱河造成了極大的恐慌,老刑警劉巖吠勘,帶你破解...
    沈念sama閱讀 218,122評論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件性芬,死亡現(xiàn)場離奇詭異,居然都是意外死亡剧防,警方通過查閱死者的電腦和手機(jī)植锉,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,070評論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來峭拘,“玉大人俊庇,你說我怎么就攤上這事狮暑。” “怎么了暇赤?”我有些...
    開封第一講書人閱讀 164,491評論 0 354
  • 文/不壞的土叔 我叫張陵心例,是天一觀的道長。 經(jīng)常有香客問我鞋囊,道長止后,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,636評論 1 293
  • 正文 為了忘掉前任溜腐,我火速辦了婚禮译株,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘挺益。我一直安慰自己歉糜,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,676評論 6 392
  • 文/花漫 我一把揭開白布望众。 她就那樣靜靜地躺著匪补,像睡著了一般。 火紅的嫁衣襯著肌膚如雪烂翰。 梳的紋絲不亂的頭發(fā)上夯缺,一...
    開封第一講書人閱讀 51,541評論 1 305
  • 那天,我揣著相機(jī)與錄音甘耿,去河邊找鬼踊兜。 笑死,一個胖子當(dāng)著我的面吹牛佳恬,可吹牛的內(nèi)容都是我干的捏境。 我是一名探鬼主播,決...
    沈念sama閱讀 40,292評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼毁葱,長吁一口氣:“原來是場噩夢啊……” “哼垫言!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起头谜,我...
    開封第一講書人閱讀 39,211評論 0 276
  • 序言:老撾萬榮一對情侶失蹤骏掀,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后柱告,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,655評論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡笑陈,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,846評論 3 336
  • 正文 我和宋清朗相戀三年际度,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片涵妥。...
    茶點(diǎn)故事閱讀 39,965評論 1 348
  • 序言:一個原本活蹦亂跳的男人離奇死亡乖菱,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情窒所,我是刑警寧澤鹉勒,帶...
    沈念sama閱讀 35,684評論 5 347
  • 正文 年R本政府宣布,位于F島的核電站吵取,受9級特大地震影響禽额,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜皮官,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,295評論 3 329
  • 文/蒙蒙 一脯倒、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧捺氢,春花似錦藻丢、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,894評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至馍佑,卻和暖如春斋否,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背挤茄。 一陣腳步聲響...
    開封第一講書人閱讀 33,012評論 1 269
  • 我被黑心中介騙來泰國打工如叼, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人穷劈。 一個月前我還...
    沈念sama閱讀 48,126評論 3 370
  • 正文 我出身青樓笼恰,卻偏偏與公主長得像,于是被迫代替她去往敵國和親歇终。 傳聞我的和親對象是個殘疾皇子社证,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,914評論 2 355