本文整理汇总了Java中android.graphics.drawable.Animatable.stop方法的典型用法代码示例。如果您正苦于以下问题:Java Animatable.stop方法的具体用法?Java Animatable.stop怎么用?Java Animatable.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.Animatable
的用法示例。
在下文中一共展示了Animatable.stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stop
import android.graphics.drawable.Animatable; //导入方法依赖的package包/类
public void stop() {
Animatable animatable = (Animatable) getDrawable();
if (animatable.isRunning()) {
animatable.stop();
}
setVisibility(View.GONE);
}
示例2: stopAnimatable
import android.graphics.drawable.Animatable; //导入方法依赖的package包/类
private void stopAnimatable() {
if (drawable instanceof Animatable) {
Animatable animatable = (Animatable) drawable;
if (animatable.isRunning()) {
animatable.stop();
drawable.setCallback(null);
}
}
}
示例3: setImageDrawable
import android.graphics.drawable.Animatable; //导入方法依赖的package包/类
private static void setImageDrawable(@NonNull ImageView imageView, @DrawableRes int drawableResId, @NonNull Enum<?> type, @ColorInt int tintColor) {
if (drawableResId == 0) {
Log.e(TAG, "The drawable for the " + type.name() + " type is not valid");
return;
}
Drawable drawable = ResourcesCompat.getDrawable(imageView.getContext(), drawableResId);
if (drawable == null) {
Log.e(TAG, "The drawable with id " + drawableResId + " is null");
return;
}
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.M) {
drawable = drawable.mutate();
}
if (tintColor != 0) {
drawable.setColorFilter(tintColor, PorterDuff.Mode.SRC_IN);
}
imageView.setImageDrawable(drawable);
imageView.setTag(R.id.eavd_current_type, type);
imageView.setTag(R.id.eavd_current_tint_color, tintColor);
if (drawable instanceof Animatable) {
Animatable animatable = (Animatable) drawable;
if (animatable.isRunning()) {
animatable.stop();
}
animatable.start();
}
}