本文整理了Java中android.widget.Button.getWidth()
方法的一些代码示例,展示了Button.getWidth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getWidth()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:getWidth
暂无
代码示例来源:origin: chrisk44/Hijacker
normalTestBtnWidth = speedTestBtn.getWidth();
ValueAnimator testBtnAnimator = ValueAnimator.ofInt(speedTestBtn.getWidth(), 0);
testBtnAnimator.setTarget(speedTestBtn);
testBtnAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
代码示例来源:origin: stackoverflow.com
final Button button1 = (Button) findViewById(R.id.button25);
first.post( new Runnable() {
public void run() {
LinearLayout.LayoutParams params =
(LinearLayout.LayoutParams) button1.getLayoutParams();
params.height = button1.getWidth();
}
});
代码示例来源:origin: GitLqr/MaterialDesignDemo
@Override
public void onClick(View v) {
Animator circularReveal = ViewAnimationUtils.createCircularReveal(btnReveal1, btnReveal1.getWidth() / 2, btnReveal1.getHeight() / 2, 0, (float) Math.hypot(btnReveal1.getWidth(), btnReveal1.getHeight()));
circularReveal.setDuration(1000);
circularReveal.setInterpolator(new AccelerateInterpolator());
circularReveal.start();
}
});
代码示例来源:origin: GitLqr/MaterialDesignDemo
@Override
public void onClick(View v) {
Animator circularReveal = ViewAnimationUtils.createCircularReveal(btnReveal2, 0, 0, 0, (float) Math.hypot(btnReveal2.getWidth(), btnReveal2.getHeight()));
circularReveal.setDuration(1000);
circularReveal.setInterpolator(new AccelerateInterpolator());
circularReveal.start();
}
});
代码示例来源:origin: InnoFang/Android-Code-Demos
@Override
public void onClick(View v) {
mIsCheater = true;
if (mAnswerIsTrue){
mAnswerTextView.setText(R.string.true_button);
}else {
mAnswerTextView.setText(R.string.false_button);
}
setAnswerShownResult(true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int cx = mShowAnswer.getWidth() / 2;
int cy = mShowAnswer.getHeight() / 2;
float radius = mShowAnswer.getWidth();
Animator anim = ViewAnimationUtils.createCircularReveal(mShowAnswer, cx, cy, radius, 0);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mShowAnswer.setVisibility(View.INVISIBLE);
}
});
anim.start();
}else{
mShowAnswer.setVisibility(View.INVISIBLE);
}
}
});
代码示例来源:origin: stackoverflow.com
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
widthButton=button1.getWidth();
if (widthButton==0) return;
LayoutParams lp = button2.getLayoutParams();
代码示例来源:origin: minggo620/AndroidAutoClick
@Override
public void run() {
setSimulateClick(tagBt,tagBt.getWidth()/2-tagBt.getX(),tagBt.getHeight()/2+tagBt.getY());
}
},1000);
代码示例来源:origin: minggo620/AndroidAutoClick
@Override
public void run() {
setSimulateClick(btnShowSpot,btnShowSpot.getWidth()/2-btnShowSpot.getX(),btnShowSpot.getHeight()/2+btnShowSpot.getY());
}
},1500);
代码示例来源:origin: stackoverflow.com
buttongame1.setY(r.nextInt(height - buttongame1.getWidth()));
代码示例来源:origin: zhangliangzs/KDemo
private void showSpinWindow() {
mSpinerPopWindow.setWidth(spinerButton.getWidth());
mSpinerPopWindow.showAtLocation(spinerButton, Gravity.BOTTOM | Gravity.RIGHT, 0, spinerButton.getHeight());
}
代码示例来源:origin: codechimp-org/AppRater
@Override
public void onShow(DialogInterface dialog) {
try {
final Button buttonPositive = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
if (buttonPositive == null) {
return;
}
LinearLayout linearLayout = (LinearLayout)buttonPositive.getParent();
if (linearLayout == null) {
return;
}
// Check positive button not fits in window
boolean shouldUseVerticalLayout = false;
if (buttonPositive.getLeft() + buttonPositive.getWidth() > linearLayout.getWidth()) {
shouldUseVerticalLayout = true;
}
// Change layout orientation to vertical
if (shouldUseVerticalLayout ) {
linearLayout.setOrientation(LinearLayout.VERTICAL);
linearLayout.setGravity(Gravity.END);
}
} catch (Exception ignored) {
}
}
});
代码示例来源:origin: AndBible/and-bible
int popupWidth = Math.max(mPreviewText.getMeasuredWidth(), buttonInfo.button.getWidth() + mPreviewText.getPaddingLeft() + mPreviewText.getPaddingRight());
int popupPreviewY;
if (buttonInfo.rowNo<2) {
int horizontalOffset = (2*buttonInfo.button.getWidth());
代码示例来源:origin: li2/learning-android-open-source
@Override
public void onClick(View v) {
int xValue = container.getWidth() - animatingButton.getWidth();
int yValue = container.getHeight() - animatingButton.getHeight();
animatingButton.animate().x(xValue).y(yValue);
}
});
代码示例来源:origin: wasdennnoch/AndroidN-ify
private void revealTheButton(Button v) {
XposedHook.logD("androidn_ify", "reveal");
mSelectedContainer.setVisibility(View.VISIBLE);
int centerX = v.getLeft() + v.getWidth() / 2;
int centerY = v.getTop() + v.getHeight() / 2;
Animator reveal = ViewAnimationUtils.createCircularReveal( // TODO work out why this isn't working, same for hide
mSelectedContainer,
centerX,
centerY,
0,
Math.max(centerX, mSelectedContainer.getWidth() - centerX)
+ Math.max(centerY, mSelectedContainer.getHeight() - centerY));
reveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mButton.setVisibility(View.INVISIBLE);
}
});
reveal.start();
//animateHintText(mSelectedLabel, v, reveal);
animateHintText(mLaunchHint, v, reveal);
mSelectedLabel.setText(v.getText());
mLayout.postDelayed(mHideRunnable, HIDE_DELAY);
mLayout.postDelayed(mRippleRunnable, RIPPLE_PAUSE / 2);
// Transfer focus from the originally clicked button to the expanded button.
mSelectedContainer.requestFocus();
}
内容来源于网络,如有侵权,请联系作者删除!