本文整理汇总了Java中android.graphics.drawable.Animatable.start方法的典型用法代码示例。如果您正苦于以下问题:Java Animatable.start方法的具体用法?Java Animatable.start怎么用?Java Animatable.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.Animatable
的用法示例。
在下文中一共展示了Animatable.start方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeUpdateAnimatable
import android.graphics.drawable.Animatable; //导入方法依赖的package包/类
private void maybeUpdateAnimatable(@Nullable Z resource) {
if (resource instanceof Animatable) {
animatable = (Animatable) resource;
animatable.start();
} else {
animatable = null;
}
}
示例2: start
import android.graphics.drawable.Animatable; //导入方法依赖的package包/类
public void start() {
setVisibility(View.VISIBLE);
Animatable animatable = (Animatable) getDrawable();
if (!animatable.isRunning()) {
animatable.start();
}
}
示例3: startAnimatable
import android.graphics.drawable.Animatable; //导入方法依赖的package包/类
private void startAnimatable() {
if (drawable instanceof Animatable) {
Animatable animatable = (Animatable) drawable;
if (!animatable.isRunning()) {
drawable.setCallback(viewGroup);
animatable.start();
}
}
}
示例4: 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();
}
}