本文整理了Java中android.widget.Button.startAnimation()
方法的一些代码示例,展示了Button.startAnimation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.startAnimation()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:startAnimation
暂无
代码示例来源:origin: stackoverflow.com
mActive = true;
animatedButton.startAnimation(animation);
代码示例来源:origin: stackoverflow.com
public void onCreate(Bundle savedInstanceState) {
final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
animation.setDuration(500); // duration - half a second
animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
final Button btn = (Button) findViewById(R.id.your_btn);
btn.startAnimation(animation);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View view) {
view.clearAnimation();
}
});
}
代码示例来源:origin: TangoAgency/material-intro-screen
private void showMessageButton(final SlideFragment fragment) {
if (messageButton.getVisibility() != View.VISIBLE) {
messageButton.setVisibility(View.VISIBLE);
if (fragment.getActivity() != null) {
messageButton.startAnimation(AnimationUtils.loadAnimation(fragment.getActivity(), R.anim.fade_in));
}
}
}
}
代码示例来源:origin: TangoAgency/material-intro-screen
@Override
public void pageSelected(int position) {
final SlideFragment slideFragment = adapter.getItem(position);
if (slideFragment.hasAnyPermissionsToGrant()) {
showMessageButton(slideFragment);
messageButton.setText(slideFragment.getActivity().getString(R.string.grant_permissions));
messageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
slideFragment.askForPermissions();
}
});
} else if (checkIfMessageButtonHasBehaviour(position)) {
showMessageButton(slideFragment);
messageButton.setText(messageButtonBehaviours.get(position).getMessageButtonText());
messageButton.setOnClickListener(messageButtonBehaviours.get(position).getClickListener());
} else if (messageButton.getVisibility() != View.INVISIBLE) {
messageButton.startAnimation(AnimationUtils.loadAnimation(slideFragment.getContext(), R.anim.fade_out));
messageButton.setVisibility(View.INVISIBLE);
}
}
代码示例来源:origin: tianshaojie/AndroidFine
@Override
public void onPageSelected(int position) {
if (position == images.length - 1) {
btnHome.setVisibility(View.VISIBLE);
btnHome.startAnimation(fadeIn);
} else {
btnHome.setVisibility(View.GONE);
}
}
代码示例来源:origin: doc-rj/smartcard-reader
@Override
public void run() {
Animation shake = AnimationUtils.loadAnimation(AppSelectActivity.this, R.anim.shake);
mSelectButton.startAnimation(shake);
}
});
代码示例来源:origin: myxh/CoolShopping
@Override
public void onPageSelected(int position) {
if (position == mViewList.size()-1) {
mBtnStart.setVisibility(View.VISIBLE);
Animation animation = AnimationUtils.loadAnimation(GuideActivity.this,R.anim.anim_guide_btn_start);
mBtnStart.startAnimation(animation);
} else {
mBtnStart.setVisibility(View.GONE);
}
}
代码示例来源:origin: searchy2/CustomPermissionsDialogue
@Override
public void onClick(View view) {
mButton.startAnimation(AnimateButton());
Handler handler = new Handler();
Runnable r = new Runnable() {
public void run() {
dismiss();
}
};
handler.postDelayed(r, 250);
}
});
代码示例来源:origin: totond/YMenuView
public void showMenu() {
if (!isShowMenu) {
for (OptionButton button : optionButtonList) {
button.onShow();
}
if (menuOpenAnimation != null) {
mYMenuButton.startAnimation(menuOpenAnimation);
}
isShowMenu = true;
}
}
代码示例来源:origin: searchy2/CustomPermissionsDialogue
@Override
public void onClick(View view) {
mButton.startAnimation(AnimateButton());
Handler handler = new Handler();
Runnable r = new Runnable() {
public void run() {
dismiss();
}
};
handler.postDelayed(r, 250);
}
});
代码示例来源:origin: huangweicai/OkLibDemo
public void showMenu() {
if (!isShowMenu) {
for (OptionButton button : optionButtonList) {
button.onShow();
}
if (menuOpenAnimation != null) {
mYMenuButton.startAnimation(menuOpenAnimation);
}
isShowMenu = true;
}
}
代码示例来源:origin: huangweicai/OkLibDemo
public void closeMenu() {
if (isShowMenu) {
for (OptionButton button : optionButtonList) {
button.onClose();
}
if (menuCloseAnimation != null) {
mYMenuButton.startAnimation(menuCloseAnimation);
}
isShowMenu = false;
}
}
代码示例来源:origin: totond/YMenuView
public void closeMenu() {
if (isShowMenu) {
for (OptionButton button : optionButtonList) {
button.onClose();
}
if (menuCloseAnimation != null) {
mYMenuButton.startAnimation(menuCloseAnimation);
}
isShowMenu = false;
}
}
代码示例来源:origin: ShawnBaker/RPiCameraViewer
@Override
public void run()
{
Animation fadeInName = new AlphaAnimation(0, 1);
fadeInName.setDuration(FADEIN_ANIMATION_TIME);
fadeInName.setFillAfter(true);
Animation fadeInSnapshot = new AlphaAnimation(0, 1);
fadeInSnapshot.setDuration(FADEIN_ANIMATION_TIME);
fadeInSnapshot.setFillAfter(true);
nameView.startAnimation(fadeInName);
closeButton.startAnimation(fadeInSnapshot);
snapshotButton.startAnimation(fadeInSnapshot);
fadeListener.onStartFadeIn();
}
};
代码示例来源:origin: searchy2/CustomPermissionsDialogue
@Override
public void onClick(View view) {
mButton.startAnimation(AnimateButton());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ArrayList<String> requestPermissions = getRequiredRequestPermissions();
if (!requestPermissions.isEmpty()) {
requestPermissions(requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISSIONS);
} else {
}
} else {
}
}
});
代码示例来源:origin: ShawnBaker/RPiCameraViewer
@Override
public void run()
{
Animation fadeOutName = new AlphaAnimation(1, 0);
fadeOutName.setDuration(FADEOUT_ANIMATION_TIME);
fadeOutName.setFillAfter(true);
Animation fadeOutSnapshot = new AlphaAnimation(1, 0);
fadeOutSnapshot.setDuration(FADEOUT_ANIMATION_TIME);
fadeOutSnapshot.setFillAfter(true);
nameView.startAnimation(fadeOutName);
closeButton.startAnimation(fadeOutSnapshot);
snapshotButton.startAnimation(fadeOutSnapshot);
fadeListener.onStartFadeOut();
}
};
代码示例来源:origin: stackoverflow.com
public void onCreate(Bundle savedInstanceState) {
final Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
animation.setDuration(500); // duration - half a second
animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
animation.setRepeatMode(Animation.REVERSE); // Reverse animation at the end so the button will fade back in
final Button btn = (Button) findViewById(R.id.your_btn);
btn.startAnimation(animation);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View view) {
view.clearAnimation();
}
});
}
代码示例来源:origin: searchy2/CustomPermissionsDialogue
@Override
public void onClick(View view) {
mButton.startAnimation(AnimateButton());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ArrayList<String> requestPermissions = getRequiredRequestPermissions();
if (!requestPermissions.isEmpty()) {
requestPermissions(requestPermissions.toArray(new String[requestPermissions.size()]), REQUEST_PERMISSIONS);
}
else
{
}
} else {
}
}
});
代码示例来源:origin: stackoverflow.com
final Button anotherButton = (Button) findViewById(/*your_another_button_id*/);
view.setOnClickListener(new OnClickListener
({
@Override
public void onClick(View view)
{
TranslateAnimation animate = new TranslateAnimation(0,0,0,anotherButton.getHeight());
animate.setDuration(500);
animate.setFillAfter(true);
anotherButton.startAnimation(animate);
anotherButton.setVisibility(View.GONE);
}
}));
代码示例来源:origin: WiInputMethod/VE
@Override
public void onStart() {
super.onStart();
//把透明度调节放在这里,这样前景和后景的透明度可以一起调节
AlphaAnimation aa = new AlphaAnimation(0f, 0f);
aa.setDuration(0);
aa.setFillAfter(true);
page6Summary.startAnimation(aa);
page6Success.startAnimation(aa);
page6Number.startAnimation(aa);
}
内容来源于网络,如有侵权,请联系作者删除!