本文整理汇总了Java中android.view.View.clearAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java View.clearAnimation方法的具体用法?Java View.clearAnimation怎么用?Java View.clearAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.clearAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shake
import android.view.View; //导入方法依赖的package包/类
public static void shake(final View view, final Animator.AnimatorListener listener) {
view.clearAnimation();
view.post(new Runnable() {
@Override
public void run() {
view.setPivotX(view.getWidth()/2);
view.setPivotY(view.getHeight());
ObjectAnimator shakeAnim = ObjectAnimator.ofFloat(view, "rotation", 0f,-15f,0f, 15f, 0f).setDuration(1200);
// shakeAnim.setInterpolator(new AccelerateInterpolator());
if(listener!=null) {
shakeAnim.addListener(listener);
}
shakeAnim.setStartDelay(500);
shakeAnim.start();
}
});
}
示例2: startBeatsAnimation
import android.view.View; //导入方法依赖的package包/类
@UiThread public static void startBeatsAnimation(@NonNull View view) {
view.clearAnimation();
if (view.getAnimation() != null) {
view.getAnimation().cancel();
}
List<ObjectAnimator> animators = getBeats(view);
for (ObjectAnimator anim : animators) {
anim.setDuration(300).start();
anim.setInterpolator(interpolator);
}
}
示例3: clearTarget
import android.view.View; //导入方法依赖的package包/类
private void clearTarget() {
View view = getTarget();
int size = this.mTuples.size();
for (int i = 0; i < size; i++) {
if (view.getAnimation() == ((Tuple) this.mTuples.get(i)).mAnimation) {
view.clearAnimation();
}
}
this.mViewRef = null;
this.mLastMatch = null;
this.mRunningAnimation = null;
}
示例4: hide
import android.view.View; //导入方法依赖的package包/类
/**
* 隐藏指定控件
*
* @param v 需要隐藏的控件
* @param endAnim 结束动画
*/
public final void hide(final View v, Animation endAnim) {
if (v == null || mView.indexOfChild(v) < 0) return;
//获得出场动画
if (endAnim == null) endAnim = getEndAnimation();
v.clearAnimation();
//开始出场动画
v.startAnimation(endAnim);
//动画结束后移除控件
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (v == null || mView.indexOfChild(v) < 0) return;
//移除指定控件
mView.removeView(v);
//隐藏顶层容器控件
if (mView.getChildCount() == 1) hideToast();
}
}, TIME_END_ANIM);
}
示例5: slidingToY
import android.view.View; //导入方法依赖的package包/类
public void slidingToY(View view ,float y){
if(view == null){
return;
}
view.clearAnimation();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
view.setY(y);
}else{
ViewHelper.setY(view, y);
}
}
示例6: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(final View v) {
if (currentLookForWid.getText().equals(" ")) {
v.startAnimation(notItAnim);
return;
}
String symv = (String)v.getTag();
TextView wid2 = activeSyms.get(current);
if (wid2==null) return;
String symw = (String)wid2.getTag();
if (symv.equals(symw)) {
Log.d("Doda", "Found " + symv.codePointAt(0));
v.setAlpha(.6f);
v.startAnimation(wasItAnim);
final ImageView blow = new ImageView(this);
blow.setBackgroundResource(R.drawable.explosion);
Point location = symPoints.get((TextView)v);
float fac = 1.25f;
score += Math.max(100, 5000 - (System.currentTimeMillis() - findTime)) * (backgroundImage?1.5:1);
int msize = spToPx((int)(mMode.getMaxIconSize(bsize)*fac));
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(msize, msize);
lp.setMargins(location.x - (int)(mMode.getMaxIconSize(bsize)*fac/2), location.y - (int)(mMode.getMaxIconSize(bsize)*fac/2), 0, 0);
lp.gravity = Gravity.START | Gravity.TOP;
blow.setLayoutParams(lp);
mSoundEffects.playPlode();
v.clearAnimation();
mMainScreen.removeView(v);
activeSyms.set(current, null);
mMainScreen.addView(blow);
AnimationDrawable ad = ((AnimationDrawable) blow.getBackground());
int time = ad.getNumberOfFrames() * ad.getDuration(0);
ad.start();
showNext(false);
mMainScreen.postDelayed(new Runnable() {
@Override
public void run() {
mMainScreen.removeView(blow);
}
}, time + 20);
} else {
v.startAnimation(notItAnim);
if (mMode.isTimed()) {
startTime -= 5000;
showMessage(getString(R.string.miss_penalty));
}
}
}
示例7: transition
import android.view.View; //导入方法依赖的package包/类
/**
* Always clears the current animation on the view using
* {@link android.view.View#clearAnimation()}, then starts the
* {@link android.view.animation.Animation} given in the constructor using
* {@link android.view.View#startAnimation(android.view.animation.Animation)} and then returns
* {@code false} because the animation does not actually put the current resource on the view.
*
* @param current {@inheritDoc}
* @param adapter {@inheritDoc}
* @return {@inheritDoc}
*/
@Override
public boolean transition(R current, ViewAdapter adapter) {
View view = adapter.getView();
if (view != null) {
view.clearAnimation();
Animation animation = viewTransitionAnimationFactory.build(view.getContext());
view.startAnimation(animation);
}
return false;
}
示例8: slidingByDelta
import android.view.View; //导入方法依赖的package包/类
public void slidingByDelta(View view ,float delta){
if(view == null){
return;
}
view.clearAnimation();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
view.setTranslationY(delta);
}else{
ViewHelper.setTranslationY(view, delta);
}
}
示例9: itemDidDisappear
import android.view.View; //导入方法依赖的package包/类
private void itemDidDisappear() {
final int itemCount = mRayLayout.getChildCount();
for (int i = 0; i < itemCount; i++) {
View item = mRayLayout.getChildAt(i);
item.clearAnimation();
}
mRayLayout.switchState(false);
}
示例10: reset
import android.view.View; //导入方法依赖的package包/类
public void reset(View view, long duration){
if(view == null){
return;
}
view.clearAnimation();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
android.animation.ObjectAnimator.ofFloat(view, "translationY", 0F).setDuration(duration).start();
}else{
com.nineoldandroids.animation.ObjectAnimator.ofFloat(view, "translationY", 0F).setDuration(duration).start();
}
}
示例11: smoothTo
import android.view.View; //导入方法依赖的package包/类
public void smoothTo(View view ,float y, long duration){
if(view == null){
return;
}
view.clearAnimation();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
android.animation.ObjectAnimator.ofFloat(view, "translationY", y).setDuration(duration).start();
}else{
com.nineoldandroids.animation.ObjectAnimator.ofFloat(view, "translationY", y).setDuration(duration).start();
}
}
示例12: displayAnim
import android.view.View; //导入方法依赖的package包/类
public static void displayAnim(View view, Context context, int animId, int targetVisibility){
view.clearAnimation();
Animation anim =
android.view.animation.AnimationUtils.loadAnimation(context, animId);
view.setVisibility(targetVisibility);
view.startAnimation(anim);
}
示例13: slidingByDelta
import android.view.View; //导入方法依赖的package包/类
public void slidingByDelta(View view ,float delta){
if(view == null){
return;
}
view.clearAnimation();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
view.setTranslationY(delta);
}else{
// ViewHelper.setTranslationY(view, delta);
}
}
示例14: slidingToY
import android.view.View; //导入方法依赖的package包/类
public void slidingToY(View view ,float y){
if(view == null){
return;
}
view.clearAnimation();
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
view.setY(y);
}else{
//ViewHelper.setY(view, y);
}
}
示例15: animateIn
import android.view.View; //导入方法依赖的package包/类
public static void animateIn(final @NonNull View view, final @NonNull Animation animation) {
if (view.getVisibility() == View.VISIBLE) return;
view.clearAnimation();
animation.reset();
animation.setStartTime(0);
view.setVisibility(View.VISIBLE);
view.startAnimation(animation);
}