android.graphics.drawable.AnimatedVectorDrawable类的使用及代码示例

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

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

AnimatedVectorDrawable介绍

暂无

代码示例

代码示例来源: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: 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: 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

AnimatedVectorDrawable avd = (AnimatedVectorDrawable)
      ContextCompat.getDrawable(activity, R.drawable.avd_spotlight_arc);
  avd.setColorFilter(porterDuffColorFilter);
  mImageView.setImageDrawable(avd);
  avd.start();
} else {
  AnimatedVectorDrawableCompat avdc =

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

avd.registerAnimationCallback(new Animatable2.AnimationCallback() {
  @Override
  public void onAnimationEnd(Drawable drawable) {
avd.start();
avd2.registerAnimationCallback(new Animatable2.AnimationCallback() {
  @Override
  public void onAnimationEnd(Drawable drawable) {

代码示例来源:origin: OCNYang/Android-Animation-Set

@RequiresApi(api = Build.VERSION_CODES.M)
private void initPuppet3() {
  ImageView imageView = (ImageView) findViewById(R.id.iv_puppet3);
  Drawable drawable = imageView.getDrawable();
  if (drawable instanceof AnimatedVectorDrawable) {
    ((AnimatedVectorDrawable) drawable).registerAnimationCallback(new Animatable2.AnimationCallback() {
      @Override
      public void onAnimationStart(Drawable drawable) {
        super.onAnimationStart(drawable);
      }
      @Override
      public void onAnimationEnd(Drawable drawable) {
        super.onAnimationEnd(drawable);
        ((AnimatedVectorDrawable) drawable).unregisterAnimationCallback(this);
      }
    });
    imageView.setOnClickListener(this);
  }
}

代码示例来源:origin: OCNYang/Android-Animation-Set

@Override
  public void onAnimationEnd(Drawable drawable) {
    super.onAnimationEnd(drawable);
    ((AnimatedVectorDrawable) drawable).unregisterAnimationCallback(this);
  }
});

代码示例来源:origin: RealMoMo/Study_Android_Demo

@RequiresApi(api = Build.VERSION_CODES.M)
private void initPuppet3() {
  ImageView imageView = (ImageView) findViewById(R.id.iv_puppet3);
  Drawable drawable = imageView.getDrawable();
  if (drawable instanceof AnimatedVectorDrawable) {
    ((AnimatedVectorDrawable) drawable).registerAnimationCallback(new Animatable2.AnimationCallback() {
      @Override
      public void onAnimationStart(Drawable drawable) {
        super.onAnimationStart(drawable);
      }
      @Override
      public void onAnimationEnd(Drawable drawable) {
        super.onAnimationEnd(drawable);
        ((AnimatedVectorDrawable) drawable).unregisterAnimationCallback(this);
      }
    });
    imageView.setOnClickListener(this);
  }
}

代码示例来源:origin: RealMoMo/Study_Android_Demo

@Override
  public void onAnimationEnd(Drawable drawable) {
    super.onAnimationEnd(drawable);
    ((AnimatedVectorDrawable) drawable).unregisterAnimationCallback(this);
  }
});

代码示例来源: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: vipulyaara/betterHotels

@TargetApi(Build.VERSION_CODES.M)
private void initUi() {
  initializeToolbar();
  final AnimatedVectorDrawable avd2 = (AnimatedVectorDrawable) tvButton.getBackground();
  tvButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      tvButton.setText("Loading...");
      avd2.start();
    }
  });
  avd2.registerAnimationCallback(new Animatable2.AnimationCallback() {
    @Override
    public void onAnimationEnd(Drawable drawable) {
      tvButton.setText("Try Again");
    }
  });
}

代码示例来源: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: vipulyaara/betterHotels

avd2.registerAnimationCallback(new Animatable2.AnimationCallback() {
  @Override
  public void onAnimationEnd(Drawable drawable) {

代码示例来源: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: lypeer/GoogleClock

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

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

@Override
  public void onAnimationEnd(Drawable drawable) {
    avd.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

AnimatedVectorDrawable d = (AnimatedVectorDrawable) getDrawable(R.drawable.animated_vector); // Insert your AnimatedVectorDrawable resource identifier
mImageView.setImageDrawable(d);
d.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();

相关文章