本文整理了Java中android.widget.Button.getY()
方法的一些代码示例,展示了Button.getY()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getY()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:getY
暂无
代码示例来源:origin: vogellacompany/codeexamples-android
@Override
public void onAnimationEnd(Animator animation) {
int nextX = randon.nextInt(width);
int nextY = randon.nextInt(height);
animation1 = ObjectAnimator.ofFloat(button, "x", button.getX(),nextX);
animation1.setDuration(1400);
animation2 = ObjectAnimator.ofFloat(button, "y", button.getY(), nextY);
animation2.setDuration(1400);
set.playTogether(animation1, animation2);
set.start();
}
});
代码示例来源:origin: hiphonezhu/Android-Demos
/**
* 保存位置
*/
void savePosition() {
float x = floatingBtn.getX();
float y = floatingBtn.getY();
editor.putFloat(KEY_FLOATING_X, x);
editor.putFloat(KEY_FLOATING_Y, y);
editor.commit();
}
代码示例来源:origin: AlburIvan/SlickForm
/**
* Initialize the form submition progress by enabling the input field
*/
private void processFormFieldBegin() {
currentFieldPosition++;
FormField field = formFields.get(currentFieldPosition);
slickFormSubmitButton.setText(field.getStepLabel());
slickFieldContainer.setVisibility(View.VISIBLE);
slickFieldContainer.setAlpha(0.0f);
slickFieldContainer.animate()
.translationY(slickFormSubmitButton.getY())
.alpha(1.0f);
applySlideDownAnimationTo(slickFormSubmitButton);
slickFieldContainer.addView(field);
}
代码示例来源:origin: minggo620/AndroidAutoClick
@Override
public void run() {
setSimulateClick(btnShowSpot,btnShowSpot.getWidth()/2-btnShowSpot.getX(),btnShowSpot.getHeight()/2+btnShowSpot.getY());
}
},1500);
代码示例来源:origin: minggo620/AndroidAutoClick
@Override
public void run() {
setSimulateClick(tagBt,tagBt.getWidth()/2-tagBt.getX(),tagBt.getHeight()/2+tagBt.getY());
}
},1000);
代码示例来源:origin: hiphonezhu/Android-Demos
if (releasedChild == floatingBtn) {
float x = floatingBtn.getX();
float y = floatingBtn.getY();
if (x < (getMeasuredWidth() / 2f - releasedChild.getMeasuredWidth() / 2f)) { // 0-x/2
if (x < releasedChild.getMeasuredWidth() / 3f) {
代码示例来源:origin: totond/YMenuView
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
//为不同的Option设置延时
if (index % 2 == 1) {
animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
}
return animationSet;
}
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
0
,getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(alphaAnimation);
//设置动画延时
animationSet.setStartOffset(60*(getOptionPositionCount() - index));
return animationSet;
}
}
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
//为不同的Option设置延时
if (index % 2 == 1) {
animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
}
return animationSet;
}
代码示例来源:origin: huangweicai/OkLibDemo
0, getYMenuButton().getY() - optionButton.getBottom());
translateAnimation.setDuration(getOptionSD_AnimationDuration());
break;
代码示例来源:origin: totond/YMenuView
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
0
,getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(alphaAnimation);
//设置动画延时
animationSet.setStartOffset(60*(getOptionPositionCount() - index));
return animationSet;
}
}
代码示例来源:origin: totond/YMenuView
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
0
,getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(alphaAnimation);
//为不同的Option设置延时
if (index % 2 == 0) {
animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
}
return animationSet;
}
}
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public Animation createOptionDisappearAnimation(OptionButton optionButton, int index) {
AnimationSet animationSet = new AnimationSet(true);
TranslateAnimation translateAnimation= new TranslateAnimation(
0
,getYMenuButton().getX() - optionButton.getX()
,0
,getYMenuButton().getY() - optionButton.getY()
);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(1,0);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(translateAnimation);
animationSet.addAnimation(alphaAnimation);
//为不同的Option设置延时
if (index % 2 == 0) {
animationSet.setStartOffset(getOptionSD_AnimationDuration()/2);
}
return animationSet;
}
}
代码示例来源:origin: totond/YMenuView
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
float fromX,fromY;
AnimationSet animationSet = new AnimationSet(true);
if (index < 3){
fromX = getYMenuButton().getX() - optionButton.getX();
fromY = getYMenuButton().getY() - optionButton.getY();
}else {
int oldIndex = (index - 3) / 2;
fromX = getOptionButtonList().get(oldIndex).getX() - optionButton.getX();
fromY = getOptionButtonList().get(oldIndex).getY() - optionButton.getY();
//设置冒出动画延时
animationSet.setStartOffset(getOptionSD_AnimationDuration());
}
TranslateAnimation translateAnimation= new TranslateAnimation(
fromX
,0
,fromY
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
animationSet.setInterpolator(new LinearInterpolator());
return animationSet;
}
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
float fromX,fromY;
AnimationSet animationSet = new AnimationSet(true);
if (index < 3){
fromX = getYMenuButton().getX() - optionButton.getX();
fromY = getYMenuButton().getY() - optionButton.getY();
}else {
int oldIndex = (index - 3) / 2;
fromX = getOptionButtonList().get(oldIndex).getX() - optionButton.getX();
fromY = getOptionButtonList().get(oldIndex).getY() - optionButton.getY();
//设置冒出动画延时
animationSet.setStartOffset(getOptionSD_AnimationDuration());
}
TranslateAnimation translateAnimation= new TranslateAnimation(
fromX
,0
,fromY
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
animationSet.setInterpolator(new LinearInterpolator());
return animationSet;
}
代码示例来源:origin: huangweicai/OkLibDemo
getYMenuButton().getY() - optionButton.getBottom(),0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
break;
代码示例来源:origin: totond/YMenuView
if (index < 3){
toX = getYMenuButton().getX() - optionButton.getX();
toY = getYMenuButton().getY() - optionButton.getY();
if (getOptionButtonCount() > 3) {
animationSet.setStartOffset(getOptionSD_AnimationDuration());
代码示例来源:origin: huangweicai/OkLibDemo
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
float fromX,fromY;
AnimationSet animationSet = new AnimationSet(true);
if (index < 3){
fromX = getYMenuButton().getX() - optionButton.getX();
fromY = getYMenuButton().getY() - optionButton.getY();
}else if (index < 6){
fromX = getOptionButtonList().get(0).getX() - optionButton.getX();
fromY = getOptionButtonList().get(0).getY() - optionButton.getY();
animationSet.setStartOffset(getOptionSD_AnimationDuration() );
}else {
int oldIndex = index % 5;
fromX = getOptionButtonList().get(oldIndex).getX() - optionButton.getX();
fromY = getOptionButtonList().get(oldIndex).getY() - optionButton.getY();
animationSet.setStartOffset(getOptionSD_AnimationDuration() );
}
TranslateAnimation translateAnimation= new TranslateAnimation(
fromX
,0
,fromY
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
animationSet.setInterpolator(new LinearInterpolator());
return animationSet;
}
代码示例来源:origin: totond/YMenuView
@Override
public Animation createOptionShowAnimation(OptionButton optionButton, int index) {
float fromX,fromY;
AnimationSet animationSet = new AnimationSet(true);
if (index < 3){
fromX = getYMenuButton().getX() - optionButton.getX();
fromY = getYMenuButton().getY() - optionButton.getY();
}else if (index < 6){
fromX = getOptionButtonList().get(0).getX() - optionButton.getX();
fromY = getOptionButtonList().get(0).getY() - optionButton.getY();
animationSet.setStartOffset(getOptionSD_AnimationDuration() );
}else {
int oldIndex = index % 5;
fromX = getOptionButtonList().get(oldIndex).getX() - optionButton.getX();
fromY = getOptionButtonList().get(oldIndex).getY() - optionButton.getY();
animationSet.setStartOffset(getOptionSD_AnimationDuration() );
}
TranslateAnimation translateAnimation= new TranslateAnimation(
fromX
,0
,fromY
,0);
translateAnimation.setDuration(getOptionSD_AnimationDuration());
AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
alphaAnimation.setDuration(getOptionSD_AnimationDuration());
animationSet.addAnimation(alphaAnimation);
animationSet.addAnimation(translateAnimation);
animationSet.setInterpolator(new LinearInterpolator());
return animationSet;
}
代码示例来源:origin: huangweicai/OkLibDemo
if (index < 3){
toX = getYMenuButton().getX() - optionButton.getX();
toY = getYMenuButton().getY() - optionButton.getY();
if (getOptionButtonCount() > 3) {
animationSet.setStartOffset(getOptionSD_AnimationDuration());
内容来源于网络,如有侵权,请联系作者删除!