android.graphics.drawable.AnimatedVectorDrawable.start()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(75)

本文整理了Java中android.graphics.drawable.AnimatedVectorDrawable.start()方法的一些代码示例,展示了AnimatedVectorDrawable.start()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AnimatedVectorDrawable.start()方法的具体详情如下:
包路径:android.graphics.drawable.AnimatedVectorDrawable
类名称:AnimatedVectorDrawable
方法名:start

AnimatedVectorDrawable.start介绍

暂无

代码示例

代码示例来源:origin: hitherejoe/animate

@OnClick(R.id.image_add_remove)
public void onAddRemoveImageClick() {
  AnimatedVectorDrawable drawable =
      mIsAddState ? mRemoveToAddDrawable : mAddToRemoveDrawable;
  mAddRemoveImage.setImageDrawable(drawable);
  drawable.start();
  mIsAddState = !mIsAddState;
}

代码示例来源:origin: hitherejoe/animate

@OnClick(R.id.image_twitter_heart)
public void onTwitterHeartImageClick() {
  AnimatedVectorDrawable drawable =
      mIsTwitterState ? mHeartToTwitterDrawable : mTwitterToHeartDrawable;
  mTwitterHeartImage.setImageDrawable(drawable);
  drawable.start();
  mIsTwitterState = !mIsTwitterState;
}

代码示例来源:origin: nickbutcher/plaid

private void checkConnectivity() {
  final ConnectivityManager connectivityManager
      = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
  final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
  connected = activeNetworkInfo != null && activeNetworkInfo.isConnected();
  if (!connected) {
    loading.setVisibility(View.GONE);
    if (noConnection == null) {
      final ViewStub stub = findViewById(R.id.stub_no_connection);
      noConnection = (ImageView) stub.inflate();
    }
    final AnimatedVectorDrawable avd =
        (AnimatedVectorDrawable) getDrawable(R.drawable.avd_no_connection);
    if (noConnection != null && avd != null) {
      noConnection.setImageDrawable(avd);
      avd.start();
    }
    connectivityManager.registerNetworkCallback(
        new NetworkRequest.Builder()
        .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(),
        connectivityCallback);
    monitoringConnectivity = true;
  }
}

代码示例来源:origin: nickbutcher/plaid

void revealPostingProgress() {
  Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting,
      (int) fabPosting.getPivotX(),
      (int) fabPosting.getPivotY(),
      0f,
      fabPosting.getWidth() / 2)
      .setDuration(600L);
  reveal.setInterpolator(AnimUtils.getFastOutLinearInInterpolator(this));
  reveal.start();
  AnimatedVectorDrawable uploading =
      (AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading);
  if (uploading != null) {
    fabPosting.setImageDrawable(uploading);
    uploading.start();
  }
}

代码示例来源:origin: nickbutcher/plaid

if (complete != null) {
  fabPosting.setImageDrawable(complete);
  complete.start();
  fabPosting.postDelayed(() -> fabPosting.setVisibility(View.GONE), 2100); // length of R.drawable.avd_upload_complete
if (failed != null) {
  fabPosting.setImageDrawable(failed);
  failed.start();

代码示例来源:origin: vipulyaara/betterHotels

@Override
  public void onAnimationEnd(Drawable drawable) {
    avd.start();
  }
});

代码示例来源:origin: lypeer/GoogleClock

@Override
  public void run() {
    animatedVectorDrawable.start();
  }
});

代码示例来源:origin: MathiasSeguy-Android2EE/AnimatedVectorMorphingTool

/**
   * Launch the animation on the AnimatedVectorDrawable displayed by the imageView3
   */
  private void launchAnim3() {
//            llScreenRecorder.startRecording();
    animatedVector3.start();
  }

代码示例来源:origin: stackoverflow.com

ImageView imageView = (ImageView) findViewById(R.id.image_view);
AnimatedVectorDrawable animatedVectorDrawable =
    (AnimatedVectorDrawable) getDrawable(R.drawable.animated_vector);
imageView.setImageDrawable(animatedVectorDrawable);
animatedVectorDrawable.start();

代码示例来源:origin: xuyisheng/VectorDemo

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
  public void anim3(View view) {
    ImageView imageView = (ImageView) view;
    AnimatedVectorDrawable tickToCross = (AnimatedVectorDrawable) getDrawable(R.drawable.fivestat_anim);
    imageView.setImageDrawable(tickToCross);
    if (tickToCross != null) {
      tickToCross.start();
    }
  }
}

代码示例来源:origin: cattaka/LearnAnimation

@Override
  public void onClick(View v) {
    if (v.getId() == R.id.image_logo) {
      AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) getDrawable(R.drawable.avd);
      mLogoImage.setImageDrawable(drawable);
      drawable.start();
    }
  }
}

代码示例来源:origin: RomainPiel/live-emoji

void setAnimated(boolean animated) {
    AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) imageView.getDrawable();
    if (drawable == null) {
      return;
    }
    if (animated) {
      drawable.start();
    } else {
      drawable.stop();
    }
  }
}

代码示例来源:origin: wooplr/Spotlight

avd.setColorFilter(porterDuffColorFilter);
  mImageView.setImageDrawable(avd);
  avd.start();
} else {
  AnimatedVectorDrawableCompat avdc =

代码示例来源:origin: ImangazalievM/CircleMenu

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void startVectorAnimation(boolean isOpened) {
  int iconId = isOpened ? R.drawable.ic_menu_animated : R.drawable.ic_close_animated;
  AnimatedVectorDrawable menuIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(), iconId);
  setImageDrawable(menuIcon);
  menuIcon.start();
}

代码示例来源:origin: xuyisheng/VectorDemo

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void anim2(View view) {
  ImageView imageView = (ImageView) view;
  AnimatedVectorDrawable tickToCross = (AnimatedVectorDrawable) getDrawable(R.drawable.heart_full_anim);
  AnimatedVectorDrawable crossToTick = (AnimatedVectorDrawable) getDrawable(R.drawable.heart_empty_anim);
  AnimatedVectorDrawable animDrawable = isTick2 ? crossToTick: tickToCross;
  imageView.setImageDrawable(animDrawable);
  if (animDrawable != null) {
    animDrawable.start();
  }
  isTick2 = !isTick2;
}

代码示例来源:origin: xuyisheng/VectorDemo

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void anim1(View view) {
  ImageView imageView = (ImageView) view;
  AnimatedVectorDrawable tickToCross = (AnimatedVectorDrawable) getDrawable(R.drawable.path_tick2cross_anim);
  AnimatedVectorDrawable crossToTick = (AnimatedVectorDrawable) getDrawable(R.drawable.path_cross2tick_anim);
  AnimatedVectorDrawable animDrawable = isTick1 ? crossToTick: tickToCross;
  imageView.setImageDrawable(animDrawable);
  if (animDrawable != null) {
    animDrawable.start();
  }
  isTick1 = !isTick1;
}

代码示例来源:origin: IhorKlimov/Android-Animations

@SuppressLint("NewApi")
public void animatePencil(View view) {
  Drawable d = mBinding.icon.getDrawable();
  if (Build.VERSION.SDK_INT >= 21 && d instanceof AnimatedVectorDrawable) {
    ((AnimatedVectorDrawable) d).start();
  } else if (d instanceof AnimatedVectorDrawableCompat) {
    ((AnimatedVectorDrawableCompat) d).start();
  }
}

代码示例来源:origin: lewismcgeary/AndroidtoAppleVectorLogo

public void morph() {
  AnimatedVectorDrawable prevDrawable = isShowingAndroid ? mightyMorphinAnimatedVectorDrawableReversed : mightyMorphinAnimatedVectorDrawable;
  if (prevDrawable.isRunning()) {
    prevDrawable.stop();
  }
  AnimatedVectorDrawable currentDrawable = isShowingAndroid ? mightyMorphinAnimatedVectorDrawable : mightyMorphinAnimatedVectorDrawableReversed;
  animatorImageView.setImageDrawable(currentDrawable);
  currentDrawable.start();
  isShowingAndroid = !isShowingAndroid;
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

@SuppressWarnings("ConstantConditions")
private void playAnimation(ImageView imageView, int res) {
  final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ResourceUtils.getInstance(getContext()).getDrawable(res);
  imageView.setImageDrawable(avd);
  //avd.forceAnimationOnUI();
  avd.start();
  // TODO: Figure out how to user an AVD animation callback instead, which doesn't
  // seem to be working right now...
  postDelayed(mAnimationDone, ANIMATION_DURATION);
}

代码示例来源:origin: wasdennnoch/AndroidN-ify

public void setExpanded(boolean expanded) {
  if (expanded == mExpanded) return;
  mExpanded = expanded;
  final int res = getDrawableResourceId(!mExpanded);
  // workaround to reset drawable
  //noinspection ConstantConditions
  final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) mRes
      .getDrawable(res).getConstantState().newDrawable();
  setImageDrawable(avd);
  avd.start();
  setContentDescription(getContentDescription(expanded));
}

相关文章