Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在AnimationSet中同步单独的动画?_Android_Android Animation - Fatal编程技术网

Android 如何在AnimationSet中同步单独的动画?

Android 如何在AnimationSet中同步单独的动画?,android,android-animation,Android,Android Animation,我有一个mapFragment,我正在其上应用动画集。我想要的效果是下面的“呼吸”动画。各个圆圈正在扩展和消失: 当前动画代码执行以下操作: 这看起来有点不同步。有什么方法可以达到更同步的效果吗 当前代码: ... private AnimationSet breadingAnimations; @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.o

我有一个mapFragment,我正在其上应用动画集。我想要的效果是下面的“呼吸”动画。各个圆圈正在扩展和消失:

当前动画代码执行以下操作:

这看起来有点不同步。有什么方法可以达到更同步的效果吗

当前代码:

...
private AnimationSet breadingAnimations;


@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    breadingAnimations = new AnimationSet(true);
    breadingAnimations.restrictDuration(3000);
    breadingAnimations.setStartOffset(500);

}
...
@Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;


//Add smallest image drawable overlay

        Bitmap mDotMarkerBitmap1 = generateBitmapFromDrawable(R.drawable.circle_drawable);

        GroundOverlay groundOverlay1 = mMap.addGroundOverlay(new GroundOverlayOptions()
                .image(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap1))
                .position(xDesign, 100));

        groundAnimation = new RadiusAnimation(groundOverlay1);
        groundAnimation.setRepeatCount(Animation.INFINITE);
        groundAnimation.setRepeatMode(Animation.RESTART);
        //        groundAnimation.setDuration(700);
        breadingAnimations.addAnimation(groundAnimation);


        Bitmap mDotMarkerBitmap2 = generateBitmapFromDrawable(R.drawable.circle_drawable2);
        GroundOverlay groundOverlay2 = mMap.addGroundOverlay(new GroundOverlayOptions()
                .image(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap2))
                .position(xDesign, 100));

        Animation groundAnimation2 = new RadiusAnimation(groundOverlay2);
        groundAnimation2.setRepeatCount(Animation.INFINITE);
        groundAnimation2.setRepeatMode(Animation.RESTART);
        //        groundAnimation2.setDuration(900);
        breadingAnimations.addAnimation(groundAnimation2);


        Bitmap mDotMarkerBitmap3 = generateBitmapFromDrawable(R.drawable.circle_drawable3);
        GroundOverlay groundOverlay3 = mMap.addGroundOverlay(new GroundOverlayOptions()
                .image(BitmapDescriptorFactory.fromBitmap(mDotMarkerBitmap3))
                .position(xDesign, 100));
        Animation groundAnimation3 = new RadiusAnimation(groundOverlay3);
        groundAnimation2.setRepeatCount(Animation.INFINITE);
        groundAnimation2.setRepeatMode(Animation.RESTART);
        //        groundAnimation2.setDuration(1100);
        breadingAnimations.addAnimation(groundAnimation3);

        mapFragment.getView().startAnimation(breadingAnimations); // start animation