ViewCompat.setPaddingRelative(fl_mode, mContentPadding, 0, mContentPadding, 0); ViewUtil.setBackground(fl_mode, mHeaderBackground); ViewCompat.setPaddingRelative(ll_repeat, mContentPadding, mActionOuterPadding, mContentPadding, mActionPadding);
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (tabStrip.isIndicatorAlwaysInCenter() && tabStrip.getChildCount() > 0) { View firstTab = tabStrip.getChildAt(0); View lastTab = tabStrip.getChildAt(tabStrip.getChildCount() - 1); int start = (w - Utils.getMeasuredWidth(firstTab)) / 2 - Utils.getMarginStart(firstTab); int end = (w - Utils.getMeasuredWidth(lastTab)) / 2 - Utils.getMarginEnd(lastTab); tabStrip.setMinimumWidth(tabStrip.getMeasuredWidth()); ViewCompat.setPaddingRelative(this, start, getPaddingTop(), end, getPaddingBottom()); setClipToPadding(false); } }
private void adjustIndicatorPadding() { // Add padding to the error and character counter so that they match the EditText ViewCompat.setPaddingRelative(indicatorArea, ViewCompat.getPaddingStart(editText), 0, ViewCompat.getPaddingEnd(editText), editText.getPaddingBottom()); }
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } }
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } } }
private static void updateTopBottomPadding(View view, int topPadding, int bottomPadding) { if (ViewCompat.isPaddingRelative(view)) { ViewCompat.setPaddingRelative(view, ViewCompat.getPaddingStart(view), topPadding, ViewCompat.getPaddingEnd(view), bottomPadding); } else { view.setPadding(view.getPaddingLeft(), topPadding, view.getPaddingRight(), bottomPadding); } }
private void applyModeAndGravity() { int paddingStart = 0; if (mMode == MODE_SCROLLABLE) { // If we're scrollable, or fixed at start, inset using padding paddingStart = Math.max(0, mContentInsetStart - mTabPaddingStart); } ViewCompat.setPaddingRelative(mTabStrip, paddingStart, 0, 0, 0); switch (mMode) { case MODE_FIXED: mTabStrip.setGravity(Gravity.CENTER_HORIZONTAL); break; case MODE_SCROLLABLE: mTabStrip.setGravity(GravityCompat.START); break; } updateTabViews(true); }
public TabView(Context context) { super(context); /* if (mTabBackgroundResId != 0) { setBackgroundDrawable( AppCompatDrawableManager.get().getDrawable(context, mTabBackgroundResId)); }*/ ViewCompat.setPaddingRelative(this, mTabPaddingStart, mTabPaddingTop, mTabPaddingEnd, mTabPaddingBottom); setGravity(Gravity.CENTER); setOrientation(VERTICAL); setClickable(true); }
public static void setPaddingStart(TextView target, int paddingStart) { ViewCompat.setPaddingRelative(target, paddingStart, target.getPaddingTop(), ViewCompat.getPaddingEnd(target), target.getPaddingBottom()); }
private void applyModeAndGravity() { int paddingStart = 0; if (mMode == MODE_SCROLLABLE) { // If we're scrollable, or fixed at start, inset using padding paddingStart = Math.max(0, mContentInsetStart - mTabPaddingStart); } ViewCompat.setPaddingRelative(mTabStrip, paddingStart, 0, 0, 0); switch (mMode) { case MODE_FIXED: mTabStrip.setGravity(Gravity.CENTER_HORIZONTAL); break; case MODE_SCROLLABLE: mTabStrip.setGravity(GravityCompat.START); break; } updateTabViews(true); }
@Override public void setValue(TextView view, int paddingStart) { ViewCompat.setPaddingRelative(view, paddingStart, view.getPaddingTop(), ViewCompat.getPaddingEnd(view), view.getPaddingBottom()); } };
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if (mCenterAlign) { View firstTab = ((ViewGroup) getChildAt(0)).getChildAt(0); View lastTab = ((ViewGroup) getChildAt(0)).getChildAt(((ViewGroup) getChildAt(0)).getChildCount() - 1); ViewCompat.setPaddingRelative(getChildAt(0), (getWidth() / 2) - (firstTab.getWidth() / 2), 0, (getWidth() / 2) - (lastTab.getWidth() / 2), 0); } if (mAnimatedIndicator == null) { setupAnimatedIndicator(); } onPageScrolled(mTempPosition, mTempPositionOffset, mTempPositionOffsetPixels); }
public void setHelperTextEnabled(boolean _enabled) { if (mHelperTextEnabled == _enabled) return; if (_enabled && mErrorEnabled) { setErrorEnabled(false); } if (this.mHelperTextEnabled != _enabled) { if (_enabled) { this.mHelperView = new TextView(this.getContext()); this.mHelperView.setTextAppearance(this.getContext(), this.mHelperTextAppearance); if (mHelperTextColor != null){ this.mHelperView.setTextColor(mHelperTextColor); } this.mHelperView.setVisibility(INVISIBLE); this.addView(this.mHelperView); if (this.mHelperView != null) { ViewCompat.setPaddingRelative( this.mHelperView, ViewCompat.getPaddingStart(getEditText()), 0, ViewCompat.getPaddingEnd(getEditText()), getEditText().getPaddingBottom()); } } else { this.removeView(this.mHelperView); this.mHelperView = null; } this.mHelperTextEnabled = _enabled; } }
FlexboxLayout.LayoutParams lp = flexItem.toLayoutParams(this); TextView textView = createBaseFlexItemTextView(i); ViewCompat.setPaddingRelative(textView, flexItem.paddingStart, flexItem.paddingTop, flexItem.paddingEnd, flexItem.paddingBottom); textView.setLayoutParams(lp);
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (tabStrip.isIndicatorAlwaysInCenter() && tabStrip.getChildCount() > 0) { View firstTab = tabStrip.getChildAt(0); View lastTab = tabStrip.getChildAt(getChildCount() - 1); int start = (w - Utils.getMeasuredWidth(firstTab)) / 2 - Utils.getMarginStart(firstTab); int end = (w - Utils.getMeasuredWidth(lastTab)) / 2 - Utils.getMarginEnd(lastTab); tabStrip.setMinimumWidth(tabStrip.getMeasuredWidth()); ViewCompat.setPaddingRelative(this, start, getPaddingTop(), end, getPaddingBottom()); setClipToPadding(false); } }
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (tabStrip.isIndicatorAlwaysInCenter() && tabStrip.getChildCount() > 0) { View firstTab = tabStrip.getChildAt(0); View lastTab = tabStrip.getChildAt(getChildCount() - 1); int start = (w - Utils.getMeasuredWidth(firstTab)) / 2 - Utils.getMarginStart(firstTab); int end = (w - Utils.getMeasuredWidth(lastTab)) / 2 - Utils.getMarginEnd(lastTab); tabStrip.setMinimumWidth(tabStrip.getMeasuredWidth()); ViewCompat.setPaddingRelative(this, start, getPaddingTop(), end, getPaddingBottom()); setClipToPadding(false); } }