我想使用 public void addOverlay(LatLng place, boolean isSetOverLay) {
if (isSetOverLay && groundOverlay != null) {
groundOverlay.remove();
System.gc();
Runtime.getRuntime().gc();
}
try {
if (getActivity() != null) {
isSetOveLay = true;
groundOverlay = mMap.addGroundOverlay(new
GroundOverlayOptions()
.position(place, 100)
.transparency(1f)
.zIndex(1)
.image(BitmapDescriptorFactory.fromBitmap(drawableToBitmap((getActivity()).getResources().getDrawable(R.drawable.map_overlay)))));
startOverlayAnimation(groundOverlay);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private Bitmap drawableToBitmap(Drawable drawable) {
Bitmap bitmap = null;
if (drawable instanceof BitmapDrawable) {
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
if (bitmapDrawable.getBitmap() != null) {
return bitmapDrawable.getBitmap();
}
}
try {
if (drawable.getIntrinsicWidth() <= 0 || drawable.getIntrinsicHeight() <= 0) {
bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
} else {
bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
}
} catch (Exception e) {
e.printStackTrace();
}
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
}
private void startOverlayAnimation(final GroundOverlay groundOverlay) {
AnimatorSet animatorSet = new AnimatorSet();
ValueAnimator vAnimator = ValueAnimator.ofInt(0, 100);
vAnimator.setRepeatCount(ValueAnimator.INFINITE);
vAnimator.setRepeatMode(ValueAnimator.RESTART);
vAnimator.setInterpolator(new LinearInterpolator());
vAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
final Integer val = (Integer) valueAnimator.getAnimatedValue();
groundOverlay.setDimensions(val);
}
});
ValueAnimator tAnimator = ValueAnimator.ofFloat(0, 1);
tAnimator.setRepeatCount(ValueAnimator.INFINITE);
tAnimator.setRepeatMode(ValueAnimator.RESTART);
tAnimator.setInterpolator(new LinearInterpolator());
tAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
Float val = (Float) valueAnimator.getAnimatedValue();
groundOverlay.setTransparency(val);
}
});
animatorSet.setDuration(1000);
animatorSet.playTogether(vAnimator, tAnimator);
animatorSet.start();
}
在从状态到另一状态的简单过渡中添加选项this.$state.go('contact.detail.read.step')
,并使用reload: true
钩子捕获过渡状态
onBefore
文档中有this.deregisterHook = this.$transitions.onBefore(
{
from: this.$state.current.name,
to: 'contact.detail.read.step'
},
(transition) => {
// Add the `reload: true` option here
}
);
对象:{{3}}
所以我做了options
,但这不起作用。
我该如何解决?