當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageView.startAnimation方法代碼示例

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

}
 
開發者ID:StickyTolt,項目名稱:ForeverLibrary,代碼行數:29,代碼來源:ScanManager.java

示例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);
	
}
 
開發者ID:AnyRTC,項目名稱:anyRTC-RTCP-Android,代碼行數:30,代碼來源:ScanManager.java

示例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();
	}
 
開發者ID:dufangyu1990,項目名稱:LeCatApp,代碼行數:19,代碼來源:CustomLoadDialog.java

示例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);
}
 
開發者ID:Hultron,項目名稱:LifeHelper,代碼行數:25,代碼來源:CaptureActivity.java

示例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);
}
 
開發者ID:skydoves,項目名稱:Medal,代碼行數:22,代碼來源:ExampleActivity.java

示例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);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:ImageAnimationHelper.java

示例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()));
}
 
開發者ID:snappy46,項目名稱:GuitarixDroid,代碼行數:12,代碼來源:MainActivity.java

示例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);

}
 
開發者ID:TonnyL,項目名稱:Espresso,代碼行數:28,代碼來源:CaptureActivity.java

示例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));
			}
		}
	}
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:17,代碼來源:GroupCountView.java

示例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);
 
 }
 
開發者ID:aakashno123,項目名稱:Mobile-phone-tracking-App,代碼行數:37,代碼來源:Splash.java

示例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();
  }
 
開發者ID:qizhenghao,項目名稱:HiBangClient,代碼行數:37,代碼來源:WhatsnewDoor.java

示例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);
}
 
開發者ID:iskandergaba,項目名稱:Botanist,代碼行數:11,代碼來源:SplashActivity.java

示例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);
}
 
開發者ID:nhocga1995s,項目名稱:MyCalendar,代碼行數:8,代碼來源:RecycleViewBaseViewHolder.java

示例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);
}
 
開發者ID:nhocga1995s,項目名稱:MyCalendar,代碼行數:8,代碼來源:RecycleViewBaseViewHolder.java

示例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);
	}
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:9,代碼來源:ImageUtil.java


注:本文中的android.widget.ImageView.startAnimation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。