android.widget.EditText.getMeasuredHeight()方法的使用及代码示例

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

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

EditText.getMeasuredHeight介绍

暂无

代码示例

代码示例来源:origin: rey5137/material

inputHeight = mInputView.getMeasuredHeight();
if(mInputView.getMeasuredWidth() != inputWidth || mInputView.getMeasuredHeight() != inputHeight)
  mInputView.measure(tempWidthSpec, MeasureSpec.makeMeasureSpec(inputHeight, MeasureSpec.EXACTLY));

代码示例来源:origin: facebook/litho

MeasureUtils.getViewMeasureSpec(widthSpec), MeasureUtils.getViewMeasureSpec(heightSpec));
size.height = forMeasure.getMeasuredHeight();

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

public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  EditText edit = (EditText) findViewById(R.id.edit);
  edit.setTextSize(20);       
  edit.setText("Hello, world");       
  edit.measure(0, 0);
  int height = edit.getMeasuredHeight();
}

代码示例来源:origin: derry/delion

@Override
  public void onLayoutChange(View v, int left, int top, int right, int bottom,
      int oldLeft, int oldTop, int oldRight, int oldBottom) {
    if (progressBarView.getMeasuredHeight() == input.getMeasuredHeight()
        && input.getBackground() != null) {
      // Force the text field to align better with the icon by accounting for the
      // padding introduced by the background drawable.
      input.getLayoutParams().height =
          progressBarView.getMeasuredHeight() + input.getPaddingBottom();
      v.requestLayout();
      v.removeOnLayoutChangeListener(this);
    }
  }
});

代码示例来源:origin: ShawnLin013/NumberPicker

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
  final int msrdWdth = getMeasuredWidth();
  final int msrdHght = getMeasuredHeight();
  // Input text centered horizontally.
  final int inptTxtMsrdWdth = mSelectedText.getMeasuredWidth();
  final int inptTxtMsrdHght = mSelectedText.getMeasuredHeight();
  final int inptTxtLeft = (msrdWdth - inptTxtMsrdWdth) / 2;
  final int inptTxtTop = (msrdHght - inptTxtMsrdHght) / 2;
  final int inptTxtRight = inptTxtLeft + inptTxtMsrdWdth;
  final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght;
  mSelectedText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom);
  mSelectedTextCenterX = mSelectedText.getX() + mSelectedText.getMeasuredWidth() / 2;
  mSelectedTextCenterY = mSelectedText.getY() + mSelectedText.getMeasuredHeight() / 2;
  if (changed) {
    // need to do all this when we know our size
    initializeSelectorWheel();
    initializeFadingEdges();
    final int dividerDistance = 2 * mDividerThickness + mDividerDistance;
    if (isHorizontalMode()) {
      mLeftDividerLeft = (getWidth() - mDividerDistance) / 2 - mDividerThickness;
      mRightDividerRight = mLeftDividerLeft + dividerDistance;
    } else {
      mTopDividerTop = (getHeight() - mDividerDistance) / 2 - mDividerThickness;
      mBottomDividerBottom = mTopDividerTop + dividerDistance;
    }
  }
}

代码示例来源:origin: forkachild/reel-search-android

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  final int left = getPaddingLeft();
  final int top = getPaddingTop();
  final int right = getMeasuredWidth() - getPaddingRight();
  final int bottom = getMeasuredHeight() - getPaddingBottom();
  // Layout the RecyclerView child spanning the whole view
  mRecyclerView.layout(left, top, right, bottom);
  // Calculations
  final int halfEditTextHeight = mEditText.getMeasuredHeight() / 2;
  final int centerY = (top + bottom) / 2;
  // Layout the EditText at the center
  mEditText.layout(left, centerY - halfEditTextHeight, right, centerY + halfEditTextHeight);
}

代码示例来源:origin: halzhang/EverExample

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
  if (!mHasSelectorWheel) {
    super.onLayout(changed, left, top, right, bottom);
    return;
  }
  final int msrdWdth = getMeasuredWidth();
  final int msrdHght = getMeasuredHeight();
  // Input text centered horizontally.
  final int inptTxtMsrdWdth = mInputText.getMeasuredWidth();
  final int inptTxtMsrdHght = mInputText.getMeasuredHeight();
  final int inptTxtLeft = (msrdWdth - inptTxtMsrdWdth) / 2;
  final int inptTxtTop = (msrdHght - inptTxtMsrdHght) / 2;
  final int inptTxtRight = inptTxtLeft + inptTxtMsrdWdth;
  final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght;
  mInputText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom);
  if (changed) {
    // need to do all this when we know our size
    initializeSelectorWheel();
    initializeFadingEdges();
    mTopSelectionDividerTop = (getHeight() - mSelectionDividersDistance) / 2
        - mSelectionDividerHeight;
    mBottomSelectionDividerBottom = mTopSelectionDividerTop + 2 * mSelectionDividerHeight
        + mSelectionDividersDistance;
  }
}

代码示例来源:origin: MiEcosystem/mijiaSDK

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
  if (!mHasSelectorWheel) {
    super.onLayout(changed, left, top, right, bottom);
    return;
  }
  final int msrdWdth = getMeasuredWidth();
  final int msrdHght = getMeasuredHeight();
  // Input text centered horizontally.
  final int inptTxtMsrdWdth = mInputText.getMeasuredWidth();
  final int inptTxtMsrdHght = mInputText.getMeasuredHeight();
  final int inptTxtLeft = (msrdWdth - inptTxtMsrdWdth) / 2;
  final int inptTxtTop = (msrdHght - inptTxtMsrdHght) / 2;
  final int inptTxtRight = inptTxtLeft + inptTxtMsrdWdth;
  final int inptTxtBottom = inptTxtTop + inptTxtMsrdHght;
  mInputText.layout(inptTxtLeft, inptTxtTop, inptTxtRight, inptTxtBottom);
  if (changed) {
    // need to do all this when we know our size
    initializeSelectorWheel();
    initializeFadingEdges();
    mTopSelectionDividerTop = (getHeight() - mSelectionDividersDistance) / 2
        - mSelectionDividerHeight;
    mBottomSelectionDividerBottom = mTopSelectionDividerTop + 2 * mSelectionDividerHeight
        + mSelectionDividersDistance;
  }
}

代码示例来源:origin: FreedomZZQ/YouJoin-Android

minCommentHeight = comment.getMeasuredHeight();
    minVoiceLayoutTop = lp_voice.topMargin;
    minEmojikeyboardLayoutTop = lp_emoji.topMargin;
minCommentHeight = comment.getMeasuredHeight();
minVoiceLayoutTop = lp_voice.topMargin;
minEmojikeyboardLayoutTop = lp_emoji.topMargin;
  int commentHeight = comment.getMeasuredHeight();
  int dH = commentHeight - minCommentHeight;
  mEnterHeight = minEnterHeight + dH;

相关文章

微信公众号

最新文章

更多

EditText类方法