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

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

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

EditText.getHeight介绍

暂无

代码示例

代码示例来源:origin: PrivacyApps/document-viewer

public int getActualHeight() {
    return m_edit.getHeight();
  }
}

代码示例来源:origin: vekexasia/android-edittext-validator

parentLayout.getPaddingRight(),
(int) (parentLayout.getPaddingBottom() + getEditText()
    .getHeight() * 1.05));

代码示例来源:origin: OpenCraft/AnimatedExpandableEditText

private void expandViewWithAnimation(final EditText editText, int pixelsToExpand) {
  ValueAnimator animation = ValueAnimator.ofInt((int) editText.getHeight(), (int) editText.getHeight() + pixelsToExpand);
  animateEditTextSize(editText, animation);
}

代码示例来源:origin: OpenCraft/AnimatedExpandableEditText

private void compactViewWithAnimation(final EditText editText, int pixelsToExpand) {
  ValueAnimator animation = ValueAnimator.ofInt((int) editText.getHeight(), (int) editText.getHeight() - pixelsToExpand);
  animateEditTextSize(editText, animation);
}

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

private EditText mEditText;
private Rect mRect = new Rect();
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
  final int action = MotionEventCompat.getActionMasked(ev);

  int[] location = new int[2];
  mEditText.getLocationOnScreen(location);
  mRect.left = location[0];
  mRect.top = location[1];
  mRect.right = location[0] + mEditText.getWidth();
  mRect.bottom = location[1] + mEditText.getHeight();

  int x = (int) ev.getX();
  int y = (int) ev.getY();

  if (action == MotionEvent.ACTION_DOWN && !mRect.contains(x, y)) {
    InputMethodManager input = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    input.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
  }
  return super.dispatchTouchEvent(ev);
}

代码示例来源:origin: huangfangyi/YiChat

@Override
  public void onSoftKeyBoardChange(int softKeybardHeight, boolean isShow) {
    if (isShow) {
      ThreadUtil.runInUIThread(new Runnable() {
        @Override
        public void run() {
          llInputSoft.animate().translationYBy(-editMessage.getHeight() / 2).setDuration(100).start();
          flChatList.animate().translationYBy(-editMessage.getHeight() / 2).setDuration(100).start();
        }
      }, duration);
    } else {
      btnChat.requestFocus();
      vaBottomBar.setDisplayedChild(0);
      llInputSoft.animate().translationYBy(editMessage.getHeight() / 2).setDuration(100).start();
      flChatList.animate().translationYBy(editMessage.getHeight() / 2).setDuration(100).start();
    }
  }
});

代码示例来源:origin: huangfangyi/YiChat

@Override
  public void onSoftKeyBoardChange(int softKeybardHeight, boolean isShow) {
    if (isShow) {
      ThreadUtil.runInUIThread(new Runnable() {
        @Override
        public void run() {
          if (!isKeybord) {
            isKeybord = true;
            llInputSoft.animate().translationYBy(-editMessage.getHeight() / 3).setDuration(100).start();
            flChatList.animate().translationYBy(-editMessage.getHeight() / 3).setDuration(100).start();
          }
        }
      }, duration);
    } else {
      btnChat.requestFocus();
      vaBottomBar.setDisplayedChild(0);
      llInputSoft.animate().translationYBy(editMessage.getHeight() / 3).setDuration(100).start();
      flChatList.animate().translationYBy(editMessage.getHeight() / 3).setDuration(100).start();
      isKeybord = false;
    }
  }
});

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

final TouchLayout root = (TouchLayout) findViewById(R.id.root);
final EditText text = (EditText) findViewById(R.id.text);
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

root.setOnInterceptTouchEventListener(new OnInterceptTouchEventListener() {

  @Override
  public boolean onInterceptTouchEvent(MotionEvent event) {
    final View v = getCurrentFocus();
    if(v != null && v.equals(text)) {
      final int screenCords[] = new int[2];
      text.getLocationOnScreen(screenCords);
      final Rect textRect = new Rect(screenCords[0], screenCords[1], screenCords[0] + text.getWidth(), screenCords[1] + text.getHeight());
      if(!textRect.contains(event.getRawX(), event.getRawY() {
        imm.hideSoftInputFromWindow(myTextview.getWindowToken(), 0);
        // Optionally you can also do the following:
        text.setCursorVisible(false);
        text.clearFocus(); 
      }
    }
    return false;
  }
};

代码示例来源:origin: ywwynm/EverythingDone

@Override
public void onKeyboardShow(int keyboardHeight) {
  if (mFlRoot.getPaddingBottom() == 0) {
    //set the padding of the contentView for the keyboard
    mFlRoot.setPadding(0, 0, 0, keyboardHeight);
    if (mRvCheckList == null || mRvCheckList.getVisibility() != View.VISIBLE) {
      int toScroll = DisplayUtil.getCursorY(mEtContent);
      toScroll += mEtTitle.getHeight();
      if (mRvImageAttachment != null && mRvImageAttachment.getVisibility() == View.VISIBLE) {
        toScroll += mRvImageAttachment.getHeight();
      }
      final int fToScroll = toScroll;
      mScrollView.post(new Runnable() {
        @Override
        public void run() {
          mScrollView.scrollTo(0, fToScroll - screenHeightDivide6);
        }
      });
    }
  }
}

代码示例来源:origin: conghuahuadan/CustomKeyboard

int[] etLocation = new int[2];
editText.getLocationOnScreen(etLocation);
int keyboardTop = etLocation[1] + editText.getHeight() + editText.getPaddingTop()
    + editText.getPaddingBottom();
int moveHeight = keyboardTop + baseKeyboardView.getHeight() - rect.bottom;

代码示例来源:origin: xudjx/djkeyboard

int keyboardTop = etLocation[1] + editText.getHeight() + editText.getPaddingTop() + editText.getPaddingBottom() + 1 ;   //1px is a divider
Object anchor = editText.getTag(R.id.anchor_view);
View mShowAnchorView = null;

代码示例来源:origin: xudjx/djkeyboard

int keyboardTop = etLocation[1] + editText.getHeight() + editText.getPaddingTop() + editText.getPaddingBottom() + 1 ;   //1px is a divider
Object anchor = editText.getTag(R.id.anchor_view);
View mShowAnchorView = null;

相关文章

微信公众号

最新文章

更多

EditText类方法