本文整理了Java中android.widget.ImageButton.startAnimation()
方法的一些代码示例,展示了ImageButton.startAnimation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageButton.startAnimation()
方法的具体详情如下:
包路径:android.widget.ImageButton
类名称:ImageButton
方法名:startAnimation
暂无
代码示例来源:origin: stackoverflow.com
ImageButton btn1 = (ImageButton) findViewById(R.id.bt1);
ImageButton btn2 = (ImageButton) findViewById(R.id.bt2);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
btn1.startAnimation(animRightTranslate);
btn2.startAnimation(animRightTranslate);
}
};
btn1.setOnClickListener(listener);
btn2.setOnClickListener(listener);`
代码示例来源:origin: stackoverflow.com
public class MainActivity extends Activity {
Animation animFadein,animFadeout;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_main);
animFadein = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_in);
animFadeout = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out);
Update();
}
public void Update(){
TextView lblEstadoPuerta = (TextView) findViewById(R.id.lblEstadoPuerta);
ImageButton btnabrirpuerta = (ImageButton) findViewById(R.id.btndoorstate);
btnabrirpuerta.startAnimation(animFadeout);
btnabrirpuerta.setVisibility(View.GONE);
btnabrirpuerta.setImageResource(R.drawable.go_down);
btnabrirpuerta.setVisibility(View.VISIBLE);
btnabrirpuerta.startAnimation(animFadein);
}
}
代码示例来源:origin: dakhnod/Meshenger
@Override
public void onAnimationEnd(Animation animation) {
button.setImageResource(currentCall.isVideoEnabled() ? R.drawable.baseline_camera_alt_black_off_48 : R.drawable.baseline_camera_alt_black_48);
Animation a = new ScaleAnimation(0.0f, 1.0f, 1.0f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
a.setDuration(buttonAnimationDuration / 2);
button.startAnimation(a);
}
代码示例来源:origin: WangDaYeeeeee/Mysplash
@Override
public void onAnimationEnd(Animation animation) {
if (!ended) {
ended = true;
bellBtn.clearAnimation();
loadImage(bellBtn, dot);
bellBtn.startAnimation(new ShowAnimation(bellBtn, dot));
}
}
代码示例来源:origin: whyalwaysmea/AndroidDemos
closeButton.setVisibility(View.GONE);
layoutButtons.startAnimation(alphaDisappear);
closeButton.startAnimation(alphaDisappear);
代码示例来源:origin: y20k/transistor
private void animatePlaybackButtonStateTransition(Station station) {
if (isAdded()) {
// toggle views needed for active playback
switch (station.getPlaybackState()) {
case PLAYBACK_STATE_STOPPED: {
Animation rotateCounterClockwise = AnimationUtils.loadAnimation(mActivity, R.anim.rotate_counterclockwise_fast);
rotateCounterClockwise.setAnimationListener(createAnimationListener(station));
mPlayerPlaybackButton.startAnimation(rotateCounterClockwise);
break;
}
case PLAYBACK_STATE_LOADING_STATION: {
Animation rotateClockwise = AnimationUtils.loadAnimation(mActivity, R.anim.rotate_clockwise_slow);
rotateClockwise.setAnimationListener(createAnimationListener(station));
mPlayerPlaybackButton.startAnimation(rotateClockwise);
break;
}
case PLAYBACK_STATE_STARTED: {
setupStationPlaybackButtonState(station);
break;
}
}
}
}
代码示例来源:origin: stackoverflow.com
RelativeLayout rl = new RelativeLayout(this);
ImageButton btnBar = new ImageButton(this);
RelativeLayout.LayoutParams btnParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, 80);
btnParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
btnBar.setLayoutParams(btnParams);
btnBar.setBackgroundColor(Color.RED); // test with red background
TranslateAnimation a = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0,
Animation.RELATIVE_TO_PARENT, 0,
Animation.RELATIVE_TO_PARENT, (float)100,
Animation.RELATIVE_TO_PARENT, (float)0);
a.setDuration(1000);
btnBar.startAnimation(a); // add animation while start
rl.addView(btnBar);
setContentView(rl);
代码示例来源:origin: googlecreativelab/lipswap
@OnClick(R.id.photo_chooser_background)
public void onBackgroundClick() {
mPhotoChooserContainer.startAnimation(mHideFromBottom);
mPhotoChooserContainer.setVisibility(View.GONE);
mBtnCreateNew.startAnimation(mShowFromBottom);
mBtnCreateNew.setVisibility(View.VISIBLE);
AlphaAnimation alphaOut = new AlphaAnimation(1.f, 0.f);
alphaOut.setDuration(mHideFromBottom.getDuration());
mPhotoChooserBackground.startAnimation(alphaOut);
mPhotoChooserBackground.setVisibility(View.GONE);
}
代码示例来源:origin: googlecreativelab/lipswap
/**
* Handle click on big plus sign
*/
@OnClick(R.id.btn_create_new)
public void onCreateNewClick() {
mPhotoChooserContainer.startAnimation(mShowFromBottom);
mPhotoChooserContainer.setVisibility(View.VISIBLE);
mBtnCreateNew.startAnimation(mHideFromBottom);
mBtnCreateNew.setVisibility(View.GONE);
AlphaAnimation alphaIn = new AlphaAnimation(0.f, 1.f);
alphaIn.setDuration(mShowFromBottom.getDuration());
mPhotoChooserBackground.startAnimation(alphaIn);
mPhotoChooserBackground.setVisibility(View.VISIBLE);
}
代码示例来源:origin: googlecreativelab/lipswap
private void showEditControls() {
int marginBottom = getResources().getDimensionPixelSize(R.dimen.margin_bottom);
TranslateAnimation recordAnim = new TranslateAnimation(0, 0, 0,
mRecordBtn.getHeight() + marginBottom);
recordAnim.setDuration(350);
recordAnim.setInterpolator(new AnticipateInterpolator());
mRecordBtn.startAnimation(recordAnim);
mRecordBtn.setVisibility(View.GONE);
mShowEditAnim.setStartOffset(300);
mEditContainer.startAnimation(mShowEditAnim);
mEditContainer.setVisibility(View.VISIBLE);
}
代码示例来源:origin: WangDaYeeeeee/Mysplash
@Override
public void setImage(ImageButton bellBtn, ImageView dot) {
if (AuthManager.getInstance().getNotificationManager().hasUnseenNotification()) {
if (!unread) {
bellBtn.clearAnimation();
bellBtn.startAnimation(new HideAnimation(bellBtn, dot));
}
} else {
if (unread) {
bellBtn.clearAnimation();
bellBtn.startAnimation(new HideAnimation(bellBtn, dot));
}
}
}
代码示例来源:origin: googlecreativelab/lipswap
private void hideEditControls() {
int marginBottom = getResources().getDimensionPixelSize(R.dimen.margin_bottom);
mEditContainer.startAnimation(mHideEditAnim);
mEditContainer.setVisibility(View.GONE);
TranslateAnimation recordAnim = new TranslateAnimation(0, 0,
mRecordBtn.getHeight() + marginBottom, 0);
recordAnim.setDuration(350);
recordAnim.setStartOffset(300);
recordAnim.setInterpolator(new OvershootInterpolator());
mRecordBtn.startAnimation(recordAnim);
mRecordBtn.setVisibility(View.VISIBLE);
}
代码示例来源:origin: dakhnod/Meshenger
frontSwitch.startAnimation(scale);
button.startAnimation(animation);
代码示例来源:origin: Calsign/APDE
protected void showCharInserts() {
TextView messageView = (TextView) findViewById(R.id.message);
HorizontalScrollView charInsertTray = (HorizontalScrollView) findViewById(R.id.char_insert_tray);
View buffer = findViewById(R.id.buffer);
View sep = findViewById(R.id.toggle_char_inserts_separator);
toggleCharInserts.setImageResource(errorMessage ? R.drawable.ic_caret_right_white : R.drawable.ic_caret_right_black);
// ((TextView) findViewById(R.id.message)).setVisibility(View.GONE);
// ((HorizontalScrollView) findViewById(R.id.char_insert_tray)).setVisibility(View.VISIBLE);
int total = buffer.getWidth() - sep.getWidth() - toggleCharInserts.getWidth();
RotateAnimation rotate = new RotateAnimation(180f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setInterpolator(new AccelerateDecelerateInterpolator());
rotate.setRepeatCount(0);
rotate.setDuration(200);
messageView.startAnimation(new ResizeAnimation<LinearLayout>(messageView, ResizeAnimation.DEFAULT, ResizeAnimation.DEFAULT, 0, ResizeAnimation.DEFAULT));
charInsertTray.startAnimation(new ResizeAnimation<LinearLayout>(charInsertTray, 0, buffer.getHeight(), total, buffer.getHeight()));
toggleCharInserts.startAnimation(rotate);
charInserts = true;
}
代码示例来源:origin: SecUSo/privacy-friendly-notes
btnRecord.startAnimation(animation);
startTime = System.currentTimeMillis();
AudioNoteActivity.this.runOnUiThread(new Runnable() {
代码示例来源:origin: stackoverflow.com
public class MainActivity extends AppCompatActivity {
private ImageButton img;
private boolean isSelected = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img = (ImageButton) findViewById(R.id.img);
img.setClickable(true);
img.setBackground(getDrawable(R.drawable.unselected_circle));
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
img.startAnimation(AnimationUtils.loadAnimation(getBaseContext(), android.R.anim.fade_in));
if (isSelected) {
isSelected = false;
img.setBackground(getDrawable(R.drawable.unselected_circle));
} else {
isSelected = true;
img.setBackground(getDrawable(R.drawable.selected_circle));
}
}
});
}
代码示例来源:origin: stackoverflow.com
@Override
public void onClick(View v) {
img.startAnimation(AnimationUtils.loadAnimation(getBaseContext(), android.R.anim.fade_in));
if (isSelected) {
isSelected = false;
代码示例来源:origin: Calsign/APDE
protected void hideCharInserts() {
if (!(keyboardVisible && charInserts)) {
// No need to hide them if they're already hidden
return;
}
TextView messageView = (TextView) findViewById(R.id.message);
HorizontalScrollView charInsertTray = (HorizontalScrollView) findViewById(R.id.char_insert_tray);
View buffer = findViewById(R.id.buffer);
View sep = findViewById(R.id.toggle_char_inserts_separator);
toggleCharInserts.setImageResource(errorMessage ? R.drawable.ic_caret_left_white : R.drawable.ic_caret_left_black);
int total = buffer.getWidth() - sep.getWidth() - toggleCharInserts.getWidth();
RotateAnimation rotate = new RotateAnimation(180f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setInterpolator(new AccelerateDecelerateInterpolator());
rotate.setRepeatCount(0);
rotate.setDuration(200);
messageView.startAnimation(new ResizeAnimation<LinearLayout>(messageView, 0, buffer.getHeight(), total, buffer.getHeight()));
charInsertTray.startAnimation(new ResizeAnimation<LinearLayout>(charInsertTray, ResizeAnimation.DEFAULT, ResizeAnimation.DEFAULT, 0, ResizeAnimation.DEFAULT));
toggleCharInserts.startAnimation(rotate);
charInserts = false;
}
代码示例来源:origin: stackoverflow.com
ScaleAnimation.RELATIVE_TO_PARENT, .5f);
scale.setDuration(140);
mIb.startAnimation(scale);
mIb.setVisibility(View.VISIBLE);
内容来源于网络,如有侵权,请联系作者删除!