本文整理匯總了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);
}
}