Java Code Examples for android.view.View#getPaddingBottom()
The following examples show how to use
android.view.View#getPaddingBottom() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: AutoLayout File: AutoUtils.java License: Apache License 2.0 | 6 votes |
public static void autoPadding(View view) { Object tag = view.getTag(R.id.id_tag_autolayout_padding); if (tag != null) return; view.setTag(R.id.id_tag_autolayout_padding, "Just Identify"); int l = view.getPaddingLeft(); int t = view.getPaddingTop(); int r = view.getPaddingRight(); int b = view.getPaddingBottom(); l = getPercentWidthSize(l); t = getPercentHeightSize(t); r = getPercentWidthSize(r); b = getPercentHeightSize(b); view.setPadding(l, t, r, b); }
Example 2
Source Project: SmartRefreshHorizontal File: SmartViewHolder.java License: Apache License 2.0 | 6 votes |
public SmartViewHolder(View itemView, AdapterView.OnItemClickListener mListener) { super(itemView); this.mListener = mListener; itemView.setOnClickListener(this); /* * 设置水波纹背景 */ if (itemView.getBackground() == null) { TypedValue typedValue = new TypedValue(); Resources.Theme theme = itemView.getContext().getTheme(); int top = itemView.getPaddingTop(); int bottom = itemView.getPaddingBottom(); int left = itemView.getPaddingLeft(); int right = itemView.getPaddingRight(); if (theme.resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true)) { itemView.setBackgroundResource(typedValue.resourceId); } itemView.setPadding(left, top, right, bottom); } }
Example 3
Source Project: json2view File: DynamicHelper.java License: MIT License | 6 votes |
/** * apply padding in view */ public static void applyPadding(View view, DynamicProperty property, int position) { if (view != null) { switch (property.type) { case DIMEN: { int[] padding = new int[] { view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom() }; padding[position] = property.getValueInt(); view.setPadding(padding[0], padding[1], padding[2], padding[3]); } break; } } }
Example 4
Source Project: tysq-android File: KeyboardUtils.java License: GNU General Public License v3.0 | 6 votes |
/** * Fix the bug of 5497 in Android. * <p>Don't set adjustResize</p> * * @param activity The activity. */ public static void fixAndroidBug5497(final Activity activity) { // Window window = activity.getWindow(); // int softInputMode = window.getAttributes().softInputMode; // window.setSoftInputMode(softInputMode & ~WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); final FrameLayout contentView = activity.findViewById(android.R.id.content); final View contentViewChild = contentView.getChildAt(0); final int paddingBottom = contentViewChild.getPaddingBottom(); sContentViewInvisibleHeightPre5497 = getContentViewInvisibleHeight(activity); contentView.getViewTreeObserver() .addOnGlobalLayoutListener(new OnGlobalLayoutListener() { @Override public void onGlobalLayout() { int height = getContentViewInvisibleHeight(activity); if (sContentViewInvisibleHeightPre5497 != height) { contentViewChild.setPadding( contentViewChild.getPaddingLeft(), contentViewChild.getPaddingTop(), contentViewChild.getPaddingRight(), paddingBottom + getDecorViewInvisibleHeight(activity) ); sContentViewInvisibleHeightPre5497 = height; } } }); }
Example 5
Source Project: AndroidAutoLayout File: PaddingRightAttr.java License: Apache License 2.0 | 5 votes |
@Override protected void execute(View view, int val) { int l = view.getPaddingLeft(); int t = view.getPaddingTop(); int r = val; int b = view.getPaddingBottom(); view.setPadding(l, t, r, b); }
Example 6
Source Project: android-animations File: Rotate.java License: MIT License | 5 votes |
public static AnimatorSet InUpRight(View view){ AnimatorSet animatorSet = new AnimatorSet(); float x = view.getWidth() - view.getPaddingRight(); float y = view.getHeight() - view.getPaddingBottom(); ObjectAnimator object1 = ObjectAnimator.ofFloat(view, "rotation", -90, 0); ObjectAnimator object2 = ObjectAnimator.ofFloat(view, "alpha", 0, 1); ObjectAnimator object3 = ObjectAnimator.ofFloat(view, "pivotX", x, x); ObjectAnimator object4 = ObjectAnimator.ofFloat(view, "pivotY", y, y); animatorSet.playTogether(object1, object2, object3, object4); return animatorSet; }
Example 7
Source Project: framework File: OField.java License: GNU Affero General Public License v3.0 | 5 votes |
private void initLayout() { removeAllViews(); if (useTemplate) { View layout = LayoutInflater.from(mContext).inflate( R.layout.base_control_template, this, false); if (withPadding) { int top_padding = layout.getPaddingTop(); int right_padding = layout.getPaddingRight(); int bottom_padding = layout.getPaddingBottom(); int left_padding = layout.getPaddingLeft(); if (!with_bottom_padding) { layout.setPadding(left_padding, top_padding, right_padding, 0); } if (!with_top_padding) { layout.setPadding(left_padding, 0, right_padding, bottom_padding); } } else { layout.setPadding(0, 0, 0, 0); } addView(layout); container = (ViewGroup) findViewById(R.id.control_container); img_icon = (ImageView) findViewById(android.R.id.icon); img_icon.setColorFilter(tint_color); setImageIcon(); } else { container = this; } }
Example 8
Source Project: AutoLayout-Android File: PaddingRightAttr.java License: Apache License 2.0 | 5 votes |
@Override protected void execute(View view, int val) { int l = view.getPaddingLeft(); int t = view.getPaddingTop(); int r = val; int b = view.getPaddingBottom(); view.setPadding(l, t, r, b); }
Example 9
Source Project: UltimateAndroid File: RotateOutUpLeftAnimator.java License: Apache License 2.0 | 5 votes |
@Override public void prepare(View target) { float x = target.getPaddingLeft(); float y = target.getHeight() - target.getPaddingBottom(); getAnimatorAgent().playTogether( ObjectAnimator.ofFloat(target, "alpha", 1, 0), ObjectAnimator.ofFloat(target,"rotation",0,-90), ObjectAnimator.ofFloat(target,"pivotX",x,x), ObjectAnimator.ofFloat(target,"pivotY",y,y) ); }
Example 10
Source Project: KUtils File: RotateInDownLeftAnimator.java License: Apache License 2.0 | 5 votes |
@Override public void prepare(View target) { float x = target.getPaddingLeft(); float y = target.getHeight() - target.getPaddingBottom(); getAnimatorAgent().playTogether( ObjectAnimator.ofFloat(target, "rotation", -90, 0), ObjectAnimator.ofFloat(target, "alpha", 0, 1), ObjectAnimator.ofFloat(target, "pivotX", x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y) ); }
Example 11
Source Project: AutoLayout-Android File: PaddingLeftAttr.java License: Apache License 2.0 | 5 votes |
@Override protected void execute(View view, int val) { int l = val; int t = view.getPaddingTop(); int r = view.getPaddingRight(); int b = view.getPaddingBottom(); view.setPadding(l, t, r, b); }
Example 12
Source Project: UltimateAndroid File: RotateInDownRightAnimator.java License: Apache License 2.0 | 5 votes |
@Override public void prepare(View target) { float x = target.getWidth() - target.getPaddingRight(); float y = target.getHeight() - target.getPaddingBottom(); getAnimatorAgent().playTogether( ObjectAnimator.ofFloat(target, "rotation", 90, 0), ObjectAnimator.ofFloat(target, "alpha", 0, 1), ObjectAnimator.ofFloat(target, "pivotX", x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y) ); }
Example 13
Source Project: KUtils File: RotateInUpLeftAnimator.java License: Apache License 2.0 | 5 votes |
@Override public void prepare(View target) { float x = target.getPaddingLeft(); float y = target.getHeight() - target.getPaddingBottom(); getAnimatorAgent().playTogether( ObjectAnimator.ofFloat(target, "rotation", 90, 0), ObjectAnimator.ofFloat(target, "alpha", 0, 1), ObjectAnimator.ofFloat(target, "pivotX", x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y) ); }
Example 14
Source Project: openboard File: MoreKeysKeyboardView.java License: GNU General Public License v3.0 | 5 votes |
@Override public void showMoreKeysPanel(final View parentView, final Controller controller, final int pointX, final int pointY, final KeyboardActionListener listener) { mController = controller; mListener = listener; final View container = getContainerView(); // The coordinates of panel's left-top corner in parentView's coordinate system. // We need to consider background drawable paddings. final int x = pointX - getDefaultCoordX() - container.getPaddingLeft() - getPaddingLeft(); final int y = pointY - container.getMeasuredHeight() + container.getPaddingBottom() + getPaddingBottom(); parentView.getLocationInWindow(mCoordinates); // Ensure the horizontal position of the panel does not extend past the parentView edges. final int maxX = parentView.getMeasuredWidth() - container.getMeasuredWidth(); final int panelX = Math.max(0, Math.min(maxX, x)) + CoordinateUtils.x(mCoordinates); final int panelY = y + CoordinateUtils.y(mCoordinates); container.setX(panelX); container.setY(panelY); mOriginX = x + container.getPaddingLeft(); mOriginY = y + container.getPaddingTop(); controller.onShowMoreKeysPanel(this); final MoreKeysKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate; if (accessibilityDelegate != null && AccessibilityUtils.Companion.getInstance().isAccessibilityEnabled()) { accessibilityDelegate.onShowMoreKeysKeyboard(); } }
Example 15
Source Project: UltimateAndroid File: RotateInUpRightAnimator.java License: Apache License 2.0 | 5 votes |
@Override public void prepare(View target) { float x = target.getWidth() - target.getPaddingRight(); float y = target.getHeight() - target.getPaddingBottom(); getAnimatorAgent().playTogether( ObjectAnimator.ofFloat(target, "rotation", -90, 0), ObjectAnimator.ofFloat(target, "alpha", 0, 1), ObjectAnimator.ofFloat(target, "pivotX", x, x), ObjectAnimator.ofFloat(target, "pivotY", y, y) ); }
Example 16
Source Project: Telegram File: StickerSetGroupInfoCell.java License: GNU General Public License v2.0 | 5 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), heightMeasureSpec); if (isLast) { View parent = (View) getParent(); if (parent != null) { int height = parent.getMeasuredHeight() - parent.getPaddingBottom() - parent.getPaddingTop() - AndroidUtilities.dp(24); if (getMeasuredHeight() < height) { setMeasuredDimension(getMeasuredWidth(), height); } } } }
Example 17
Source Project: AutoLayout File: PaddingTopAttr.java License: Apache License 2.0 | 5 votes |
@Override protected void execute(View view, int val) { int l = view.getPaddingLeft(); int t = val; int r = view.getPaddingRight(); int b = view.getPaddingBottom(); view.setPadding(l, t, r, b); }
Example 18
Source Project: bither-android File: SettingSelectorView.java License: Apache License 2.0 | 4 votes |
public void loadData() { tvSettingName.setText(selector.getSettingName()); if (selector.getCurrentOptionIndex() >= 0 && selector.getCurrentOptionIndex() < selector .getOptionCount()) { tvCurrentOption.setText(selector.getOptionName(selector.getCurrentOptionIndex())); } else { tvCurrentOption.setText(""); } llOptions.removeAllViews(); if (selector != null) { int count = selector.getOptionCount(); for (int i = 0; i < count; i++) { View v = inflater.inflate(R.layout.list_item_setting_option, null); llOptions.addView(v, LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); TextView tv = (TextView) v.findViewById(R.id.tv_option_name); TextView tvNote = (TextView) v.findViewById(R.id.tv_option_note); ImageView iv = (ImageView) v.findViewById(R.id.iv_check); tv.setText(selector.getOptionName(i)); CharSequence note = selector.getOptionNote(i); if (note == null || note.length() == 0) { tvNote.setText(""); } else { tvNote.setText(note); } tvNote.setCompoundDrawablesWithIntrinsicBounds(null, null, selector.getOptionDrawable(i), null); if (i == selector.getCurrentOptionIndex()) { iv.setVisibility(View.VISIBLE); } else { iv.setVisibility(View.GONE); } v.setOnClickListener(new OptionClick(i)); if (i == count - 1) { preOptionBottomSpace = v.getPaddingBottom(); v.setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), preOptionBottomSpace + bottomSpace); } } } }
Example 19
Source Project: adt-leanback-support File: ItemAlignment.java License: Apache License 2.0 | 4 votes |
/** * get alignment position relative to optical left/top of itemView. */ public int getAlignmentPosition(View itemView) { LayoutParams p = (LayoutParams) itemView.getLayoutParams(); View view = itemView; if (mViewId != 0) { view = itemView.findViewById(mViewId); if (view == null) { view = itemView; } } int alignPos; if (mOrientation == HORIZONTAL) { if (mOffset >= 0) { alignPos = mOffset; if (mOffsetWithPadding) { alignPos += view.getPaddingLeft(); } } else { alignPos = view == itemView ? p.getOpticalWidth(view) : view.getWidth() + mOffset; if (mOffsetWithPadding) { alignPos -= view.getPaddingRight(); } } if (mOffsetPercent != ITEM_ALIGN_OFFSET_PERCENT_DISABLED) { alignPos += ((view == itemView ? p.getOpticalWidth(view) : view.getWidth()) * mOffsetPercent) / 100f; } if (itemView != view) { mRect.left = alignPos; ((ViewGroup) itemView).offsetDescendantRectToMyCoords(view, mRect); alignPos = mRect.left - p.getOpticalLeftInset(); } } else { if (mOffset >= 0) { alignPos = mOffset; if (mOffsetWithPadding) { alignPos += view.getPaddingTop(); } } else { alignPos = view == itemView ? p.getOpticalHeight(view) : view.getHeight() + mOffset; if (mOffsetWithPadding) { alignPos += view.getPaddingBottom(); } } if (mOffsetPercent != ITEM_ALIGN_OFFSET_PERCENT_DISABLED) { alignPos += ((view == itemView ? p.getOpticalHeight(view) : view.getHeight()) * mOffsetPercent) / 100f; } if (itemView != view) { mRect.top = alignPos; ((ViewGroup) itemView).offsetDescendantRectToMyCoords(view, mRect); alignPos = mRect.top - p.getOpticalTopInset(); } } return alignPos; }
Example 20
Source Project: libcommon File: MeasureSpecDelegater.java License: Apache License 2.0 | 4 votes |
public static MeasureSpec onMeasure(@NonNull final View target, final double requestedAspect, @IScaledView.ScaleMode final int scaleMode, final boolean needResizeToKeepAspect, final int widthMeasureSpec, final int heightMeasureSpec) { final MeasureSpec result = new MeasureSpec(widthMeasureSpec, heightMeasureSpec); // if (DEBUG) Log.v(TAG, "onMeasure:requestedAspect=" + requestedAspect); // 要求されたアスペクト比が負の時(初期生成時)は何もしない if ((requestedAspect > 0) && (scaleMode == SCALE_MODE_KEEP_ASPECT) && needResizeToKeepAspect) { int initialWidth = View.MeasureSpec.getSize(widthMeasureSpec); int initialHeight = View.MeasureSpec.getSize(heightMeasureSpec); final int horizPadding = target.getPaddingLeft() + target.getPaddingRight(); final int vertPadding = target.getPaddingTop() + target.getPaddingBottom(); initialWidth -= horizPadding; initialHeight -= vertPadding; final double viewAspectRatio = (double)initialWidth / initialHeight; final double aspectDiff = requestedAspect / viewAspectRatio - 1; // 計算誤差が生じる可能性が有るので指定した値との差が小さければそのままにする if (Math.abs(aspectDiff) > 0.005) { if (aspectDiff > 0) { // 幅基準で高さを決める initialHeight = (int) (initialWidth / requestedAspect); } else { // 高さ基準で幅を決める initialWidth = (int) (initialHeight * requestedAspect); } initialWidth += horizPadding; initialHeight += vertPadding; result.widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(initialWidth, View.MeasureSpec.EXACTLY); result.heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(initialHeight, View.MeasureSpec.EXACTLY); } } return result; }