本文整理匯總了Java中android.graphics.drawable.Animatable.isRunning方法的典型用法代碼示例。如果您正苦於以下問題:Java Animatable.isRunning方法的具體用法?Java Animatable.isRunning怎麽用?Java Animatable.isRunning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.graphics.drawable.Animatable
的用法示例。
在下文中一共展示了Animatable.isRunning方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import android.graphics.drawable.Animatable; //導入方法依賴的package包/類
public void start() {
setVisibility(View.VISIBLE);
Animatable animatable = (Animatable) getDrawable();
if (!animatable.isRunning()) {
animatable.start();
}
}
示例2: stop
import android.graphics.drawable.Animatable; //導入方法依賴的package包/類
public void stop() {
Animatable animatable = (Animatable) getDrawable();
if (animatable.isRunning()) {
animatable.stop();
}
setVisibility(View.GONE);
}
示例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: 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);
}
}
}
示例5: 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();
}
}