/** * Returns the left padding of the view, plus space for the left * Drawable if any. */ public int getCompoundPaddingLeft (){ return mInputView.getCompoundPaddingLeft(); }
/** * Returns the start padding of the view, plus space for the start * Drawable if any. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public int getCompoundPaddingStart (){ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) return mInputView.getCompoundPaddingStart(); return mInputView.getCompoundPaddingLeft(); }
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (isHintEnabled && editText != null) { final Rect rect = tempRect; ViewGroupUtils.getDescendantRect(this, editText, rect); final int l = rect.left + editText.getCompoundPaddingLeft(); final int r = rect.right - editText.getCompoundPaddingRight(); collapsingTextHelper.setExpandedBounds( l, rect.top + editText.getCompoundPaddingTop(), r, rect.bottom - editText.getCompoundPaddingBottom()); // Set the collapsed bounds to be the the full height (minus padding) to match the // EditText's editable area collapsingTextHelper.setCollapsedBounds(l, getPaddingTop(), r, bottom - top - getPaddingBottom()); collapsingTextHelper.recalculate(); } }
protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); if (getEditText() != null) { mTextX = getEditText().getLeft() + getEditText().getCompoundPaddingLeft(); mTextY = getPaddingTop(); } }