android.widget.Button.getHeight()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中android.widget.Button.getHeight()方法的一些代码示例,展示了Button.getHeight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.getHeight()方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:getHeight

Button.getHeight介绍

暂无

代码示例

代码示例来源:origin: zyyoona7/EasyPopup

@Override
  public void onClick(View v) {
    if (mCiclePop != null) {
      mCiclePop.showAsDropDown(v,-mCiclePop.getContentView().getWidth(),-(mCommentBtn.getHeight()/2+mCiclePop.getContentView().getHeight()/2));
    }
  }
});

代码示例来源: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: Calsign/APDE

@Override
  public void run() {
    //Force the dialog to be the right size...
    
    int w = FrameLayout.LayoutParams.MATCH_PARENT;
    int h = list.getChildAt(0).getHeight()
        + loadMore.getHeight() + keepShowing.getHeight()
        + Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));
    
    layout.setLayoutParams(new FrameLayout.LayoutParams(w, h));
  }
});

代码示例来源:origin: mooshim/Mooshimeter-AndroidApp

@Override
  public void run() {
    float button_height = b.getHeight(); // Button height in raw pixels
    b.setTextSize(TypedValue.COMPLEX_UNIT_PX,button_height/3); // Divisor arrived at empirically
    b.setBackground(bg);
  }
});

代码示例来源:origin: stackoverflow.com

Button button1 = (Button) findViewById(R.id.button_1);
Button button2 = (Button) findViewById(R.id.button_2);
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);
relativeLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

  @Override
  public void onGlobalLayout() {
    relativeLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);

    RelativeLayout.LayoutParams btParams = (RelativeLayout.LayoutParams) button2.getLayoutParams();
    int height = button1.getHeight();
    btParams.height = height;
    button2.setLayoutParams(btParams);
  }
});

代码示例来源: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: apps4av/avare

int topY = (mMenuButton.getHeight() / 2) + mMenuButton.getTop();

代码示例来源: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: 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: stackoverflow.com

buttongame1.setX(r.nextInt(Width - buttongame1.getHeight()));
 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: 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();
}

相关文章

Button类方法