本文整理汇总了Java中android.widget.ImageView.startAnimation方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.startAnimation方法的具体用法?Java ImageView.startAnimation怎么用?Java ImageView.startAnimation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.startAnimation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScanManager
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* 用于启动照相机扫描二维码,在activity的onCreate里面构造出来
* 在activity的生命周期中调用此类相对应的生命周期方法
*
* @param activity 扫描的activity
* @param scanPreview 预览的SurfaceView
* @param scanContainer 扫描的布局,全屏布局
* @param scanCropView 扫描的矩形区域
* @param scanLine 扫描线
*/
public ScanManager(Activity activity, SurfaceView scanPreview, View scanContainer,
View scanCropView, ImageView scanLine, int scanMode, ScanListener listener) {
this.activity = activity;
this.scanPreview = scanPreview;
this.scanContainer = scanContainer;
this.scanCropView = scanCropView;
this.scanLine = scanLine;
this.listener = listener;
this.scanMode = scanMode;
//启动动画
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.9f);
animation.setDuration(4500);
animation.setRepeatCount(-1);
animation.setRepeatMode(Animation.RESTART);
scanLine.startAnimation(animation);
}
示例2: ScanManager
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* 用于启动照相机扫描二维码,在activity的onCreate里面构造出来
* 在activity的生命周期中调用此类相对应的生命周期方法
* @param activity 扫描的activity
* @param scanPreview 预览的SurfaceView
* @param scanContainer 扫描的布局,全屏布局
* @param scanCropView 扫描的矩形区域
* @param scanLine 扫描线
*
*
*/
public ScanManager(Activity activity, SurfaceView scanPreview, View scanContainer,
View scanCropView, ImageView scanLine, int scanMode, ScanListener listener) {
this.activity=activity;
this.scanPreview=scanPreview;
this.scanContainer=scanContainer;
this.scanCropView=scanCropView;
this.scanLine=scanLine;
this.listener=listener;
this.scanMode=scanMode;
//启动动画
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.9f);
animation.setDuration(4500);
animation.setRepeatCount(-1);
animation.setRepeatMode(Animation.RESTART);
scanLine.startAnimation(animation);
}
示例3: onWindowFocusChanged
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* 当窗口焦点改变时调用
*/
public void onWindowFocusChanged(boolean hasFocus) {
imageView = (ImageView) findViewById(R.id.spinnerImageView);
//此方法是用xml文件方式来实现动画效果
animation = AnimationUtils.loadAnimation(getContext(), R.anim.spinner);
//动画完成后,是否保留动画最后的状态,设为true
animation.setFillAfter(true);
if(animation!=null)
{
imageView.startAnimation(animation);
}
// 获取ImageView上的动画背景(此方法是用一组图片来达到动画效果)
// AnimationDrawable spinner = (AnimationDrawable) imageView.getBackground();
// // 开始动画
// spinner.start();
}
示例4: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_capture);
scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
scanLine = (ImageView) findViewById(R.id.capture_scan_line);
inactivityTimer = new InactivityTimer(this);
beepManager = new BeepManager(this);
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation
.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.9f);
animation.setDuration(4500);
animation.setRepeatCount(-1);
animation.setRepeatMode(Animation.RESTART);
scanLine.startAnimation(animation);
}
示例5: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MedalAnimation medalAnimation_tv = new MedalAnimation.Builder()
.setSpeed(3000)
.setTurn(1)
.build();
medalAnimation_tv.startAnimation(findViewById(R.id.textView_title));
MedalAnimation medalAnimation = new MedalAnimation.Builder()
.setDirection(MedalAnimation.LEFT)
.setSpeed(4200)
.setTurn(4)
.build();
ImageView imageView = (ImageView)findViewById(R.id.badge);
imageView.startAnimation(medalAnimation);
}
示例6: animationDisplay
import android.widget.ImageView; //导入方法依赖的package包/类
public static void animationDisplay(ImageView imageView, Drawable drawable, Animation animation) {
imageView.setImageDrawable(drawable);
if (cloneMethod != null && animation != null) {
try {
imageView.startAnimation((Animation) cloneMethod.invoke(animation));
} catch (Throwable ex) {
imageView.startAnimation(animation);
}
} else {
imageView.startAnimation(animation);
}
}
示例7: onClick
import android.widget.ImageView; //导入方法依赖的package包/类
/**
* Imageview event click listeners
*
* @param view Imageview that was clicked
*/
@Override
public void onClick(View view) {
ImageView image = (ImageView) view;
image.startAnimation(animFadein);
presenter.onImageViewClicked(Integer.parseInt(view.getTag().toString()));
}
示例8: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_scan);
scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
scanLine = (ImageView) findViewById(R.id.capture_scan_line);
inactivityTimer = new InactivityTimer(this);
beepManager = new BeepManager(this);
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.9f);
animation.setDuration(4500);
animation.setRepeatCount(-1);
animation.setRepeatMode(Animation.RESTART);
scanLine.startAnimation(animation);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例9: updateProgressBar
import android.widget.ImageView; //导入方法依赖的package包/类
/**
*
* @param testType
*/
public void updateProgressBar(final QoSTestResultEnum testType) {
if (viewMap != null) {
View view = viewMap.get(testType);
if (view != null) {
ImageView image = (ImageView) view.findViewById(R.id.test_view_qos_image);
if (image.getAnimation() == null) {
image.setImageResource(R.drawable.traffic_lights_yellow);
image.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.rotate));
}
}
}
}
示例10: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
iv=(ImageView)findViewById(R.id.imageView1);
tv=(TextView)findViewById(R.id.textView1);
animFadeOut=AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out);
animfadein=AnimationUtils.loadAnimation(getApplicationContext(), R.anim.together);
animFadeOut.setAnimationListener(this);
animfadein.setAnimationListener(this);
iv.startAnimation(animfadein);
tv.startAnimation(animFadeOut);
h= new Handler();
h.postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
finish();
if(!bbp)
{
Intent intent =new Intent(Splash.this,MainActivity.class);
Splash.this.startActivity(intent);
}
}
}, holding);
}
示例11: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.whats_door);
mLeft = (ImageView)findViewById(R.id.imageLeft);
mRight = (ImageView)findViewById(R.id.imageRight);
mText = (TextView)findViewById(R.id.anim_text);
AnimationSet anim = new AnimationSet(true);
TranslateAnimation mytranslateanim = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim.setDuration(2000);
anim.setStartOffset(800);
anim.addAnimation(mytranslateanim);
anim.setFillAfter(true);
mLeft.startAnimation(anim);
AnimationSet anim1 = new AnimationSet(true);
TranslateAnimation mytranslateanim1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,+1f,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f);
mytranslateanim1.setDuration(1500);
anim1.addAnimation(mytranslateanim1);
anim1.setStartOffset(800);
anim1.setFillAfter(true);
mRight.startAnimation(anim1);
AnimationSet anim2 = new AnimationSet(true);
ScaleAnimation myscaleanim = new ScaleAnimation(1f,3f,1f,3f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
myscaleanim.setDuration(1000);
AlphaAnimation myalphaanim = new AlphaAnimation(1,0.0001f);
myalphaanim.setDuration(1500);
anim2.addAnimation(myscaleanim);
anim2.addAnimation(myalphaanim);
anim2.setFillAfter(true);
mText.startAnimation(anim2);
new Thread(this).start();
}
示例12: onCreate
import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
ImageView logo = findViewById(R.id.logo_splash);
Animation myFadeInAnimation = AnimationUtils.loadAnimation(this, R.anim.blink_and_fade);
logo.startAnimation(myFadeInAnimation);
// Instantiate the database
DatabaseManager.getInstance().splashLoadAutocomplete(this);
}
示例13: doAnimationExpand
import android.widget.ImageView; //导入方法依赖的package包/类
protected void doAnimationExpand(@Nonnull ImageView imageView) {
RotateAnimation rotate =
new RotateAnimation(360, 180, RELATIVE_TO_SELF, 0.5f, RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(300);
rotate.setFillAfter(true);
imageView.startAnimation(rotate);
}
示例14: doAnimationCollapse
import android.widget.ImageView; //导入方法依赖的package包/类
protected void doAnimationCollapse(@Nonnull ImageView imageView) {
RotateAnimation rotate =
new RotateAnimation(180, 360, RELATIVE_TO_SELF, 0.5f, RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(300);
rotate.setFillAfter(true);
imageView.startAnimation(rotate);
}
示例15: rotateImageForever
import android.widget.ImageView; //导入方法依赖的package包/类
public static void rotateImageForever(Context context, ImageView ivSwap, int id) {
Animation operatingAnim = AnimationUtils.loadAnimation(context,id);
LinearInterpolator lin = new LinearInterpolator();
operatingAnim.setInterpolator(lin);
if (operatingAnim != null) {
ivSwap.startAnimation(operatingAnim);
}
}