내 MapFragment에서 호흡 효과 애니메이션을 얻으려고하고 있지만 어떤 이유로지도에서 여러 애니메이션을 실행할 수 없습니다. 무엇을 달성하려고하면이 같은 것입니다 :GroundOverlay에서 nultuple 애니메이션을 실행할 수 없습니다. [GoogleMap]
을 그리고 원은 점차 확대하고 사라져 그렇게하고 있습니다. 지금 내 애니메이션은이 일을한다 : 내가 원하는 것을 확실히하지
합니다. 현재 코드 (처리기로 2 블록의 주석 처리를 제거한 경우)는 하나의 애니메이션 만 수행하고 나머지 셰이프는 고정되어 있습니다. 편집 "startAnimation"메서드가 현재 애니메이션을 재정의하고 있습니다. 이제 어떻게하면이 재정의를 피할 수있는 방법이 있는지 궁금합니다. 어떤 아이디어? 이건 내 코드입니다
:
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
//Add smallest image drawable overlay
mDotMarkerBitmap = generateBitmapFromDrawable(R.drawable.circle_drawable);
groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions()
.image(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap))
.position(xDesign, 100));
groundAnimation = new RadiusAnimation(groundOverlay);
groundAnimation.setRepeatCount(Animation.INFINITE);
groundAnimation.setRepeatMode(Animation.RESTART);
groundAnimation.setDuration(2000);
mapFragment.getView().startAnimation(groundAnimation); // MapView where i show my map
//TODO Fix the animation tomorrow
//Add medium size image drawable overlay
// new Handler().postDelayed(new Runnable() {
// @Override
// public void run() {
// // your code here
// mDotMarkerBitmap = generateBitmapFromDrawable(R.drawable.circle_drawable2);
// groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions()
// .image(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap))
// .position(xDesign, 100));
// groundAnimation = new RadiusAnimation(groundOverlay);
// groundAnimation.setRepeatCount(Animation.INFINITE);
// groundAnimation.setRepeatMode(Animation.RESTART);
// groundAnimation.setDuration(10000);
// mapFragment.getView().startAnimation(groundAnimation); // MapView where i show my map
// }
// }, 1000/* 1sec delay */);
//
////Add smallest size image drawable overlay
// new Handler().postDelayed(new Runnable()
// {
// @Override
// public void run()
// {
// // your code here
// mDotMarkerBitmap = generateBitmapFromDrawable(R.drawable.circle_drawable3);
// groundOverlay = mMap.addGroundOverlay(new GroundOverlayOptions()
// .image(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap))
// .position(xDesign, 100));
// groundAnimation = new RadiusAnimation(groundOverlay);
// groundAnimation.setRepeatCount(Animation.INFINITE);
// groundAnimation.setRepeatMode(Animation.RESTART);
// groundAnimation.setDuration(2000);
// mapFragment.getView().startAnimation(groundAnimation); // MapView where i show my map
// }
// }, 1000/* 1sec delay */);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(xDesign, 15));
}
circle_drawable.xml (circle_drawable2와 3 폭 & 높이 값 exept 같은, 그들은 60 크고 90dp이며,
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#0093e8"/>
<size
android:width="30dp"
android:height="30dp"/>
</shape>
RadiusAnimation 클래스 :
01) 파란색과 빨간색 - 색상public class RadiusAnimation extends Animation {
private GroundOverlay groundOverlay;
public RadiusAnimation(GroundOverlay groundOverlay) {
this.groundOverlay = groundOverlay;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
groundOverlay.setDimensions((100 * interpolatedTime));
groundOverlay.setTransparency(interpolatedTime);
}
@Override
public void initialize(int width, int height, int parentWidth,int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
}
}
언급 한 것과 똑같은 애니메이션을 얻으려고합니다. 참조 용으로 코드를 사용했지만 몇 가지 문제가 있습니다. 애니메이션이 전혀 보이지 않습니다. 내가 뭘 잘못하고 있는지 모르겠다. – Neha
나는 더 이상 같은 회사에서 일하지 않기를 바라고 있으며, 따라서 나는 더 이상 내가 사용한 코드에 접근 할 수 없다. 여기에있는 코드가 애니메이션을 완성해야하는 유일한 소스입니다. 나는 그것이 나를 위해 일했다고 생각한다 :) –
괜찮아, probs. 감사 :) – Neha