List of usage examples for android.view View getPaddingBottom
public int getPaddingBottom()
From source file:com.appeaser.sublimepickerlibrary.utilities.SUtils.java
public static void setViewBackground(View view, Drawable bg) { int paddingL = view.getPaddingLeft(); int paddingT = view.getPaddingTop(); int paddingR = view.getPaddingRight(); int paddingB = view.getPaddingBottom(); if (isApi_16_OrHigher()) { view.setBackground(bg);//from w w w .ja v a 2 s . c o m } else { //noinspection deprecation view.setBackgroundDrawable(bg); } view.setPadding(paddingL, paddingT, paddingR, paddingB); }
From source file:com.desmond.ripple.view.RippleCompat.java
private static void adaptBackground(RippleCompatDrawable rippleDrawable, View v, RippleConfig config) { Drawable background;/*from w w w .j av a 2 s . c o m*/ if (v instanceof ImageView) { ImageView.ScaleType scaleType = ((ImageView) v).getScaleType(); background = ((ImageView) v).getDrawable(); rippleDrawable.setBackgroundDrawable(background).setScaleType(scaleType).setPadding(v.getPaddingLeft(), v.getPaddingTop(), v.getPaddingRight(), v.getPaddingBottom()); ((ImageView) v).setImageDrawable(null); setBackground(v, rippleDrawable); } else { if (config.getBackgroundDrawable() != null) { rippleDrawable.setBackgroundDrawable(config.getBackgroundDrawable()); rippleDrawable.setScaleType(config.getScaleType()); } background = v.getBackground(); if (background != null) { setBackground(v, new LayerDrawable(new Drawable[] { background, rippleDrawable })); } else { setBackground(v, rippleDrawable); } } }
From source file:com.google.android.apps.flexbox.FlexItem.java
public static FlexItem fromFlexView(View view, int index) { FlexboxLayout.LayoutParams lp = (FlexboxLayout.LayoutParams) view.getLayoutParams(); FlexItem flexItem = new FlexItem(); flexItem.index = index;/*from www. j a v a 2 s . com*/ flexItem.order = lp.order; flexItem.flexGrow = lp.flexGrow; flexItem.flexShrink = lp.flexShrink; flexItem.alignSelf = lp.alignSelf; flexItem.flexBasisPercent = lp.flexBasisPercent; flexItem.width = Util.pixelToDp(view.getContext(), lp.width); flexItem.height = Util.pixelToDp(view.getContext(), lp.height); flexItem.topMargin = lp.topMargin; flexItem.startMargin = MarginLayoutParamsCompat.getMarginStart(lp); flexItem.endMargin = MarginLayoutParamsCompat.getMarginEnd(lp); flexItem.bottomMargin = lp.bottomMargin; flexItem.paddingTop = view.getPaddingTop(); flexItem.paddingStart = ViewCompat.getPaddingStart(view); flexItem.paddingEnd = ViewCompat.getPaddingEnd(view); flexItem.paddingBottom = view.getPaddingBottom(); flexItem.minWidth = Util.pixelToDp(view.getContext(), lp.minWidth); flexItem.minHeight = Util.pixelToDp(view.getContext(), lp.minHeight); flexItem.maxWidth = Util.pixelToDp(view.getContext(), lp.maxWidth); flexItem.maxHeight = Util.pixelToDp(view.getContext(), lp.maxHeight); flexItem.wrapBefore = lp.wrapBefore; return flexItem; }
From source file:pl.motyczko.scrollheadersample.ColorFragment.java
/** * {@inheritDoc}/*from ww w . j a v a 2 s.c o m*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final int color = getArguments().getInt("color"); View v = inflater.inflate(R.layout.fragment_color, container, false); v.setBackgroundColor(color); int paddingTop = getActivity().findViewById(R.id.view_pager_header).getMeasuredHeight(); v.setPadding(v.getPaddingLeft(), paddingTop, v.getPaddingRight(), v.getPaddingBottom()); return v; }
From source file:com.tomeokin.lspush.biz.collect.ImageDialogFragment.java
private float optimumRadio(View content, View container, float width, float height) { final int maxWidth = content.getWidth() - container.getPaddingLeft() - container.getPaddingRight() - 50; final int maxHeight = content.getHeight() / 2 - container.getPaddingTop() - container.getPaddingBottom(); //Timber.i("maxWidth: %d, maxHeight: %d", maxWidth, maxHeight); return ImageUtils.optimumRadio(maxWidth, maxHeight, width, height); }
From source file:pl.kodujdlapolski.na4lapy.ui.drawer.DrawerActivityHandler.java
private void setDrawerHeader() { View headerView = navigationView.getHeaderView(0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { headerView.setPadding(headerView.getPaddingLeft(), (int) (headerView.getPaddingTop() + activity.getResources().getDimension(R.dimen.status_bar)), headerView.getPaddingRight(), headerView.getPaddingBottom()); }//w w w .j a v a 2 s . c o m }
From source file:com.tmall.wireless.tangram.view.BannerViewPager.java
protected void onMeasurePage(int widthMeasureSpec, int heightMeasureSpec) { View child = pagerAdapter.getViewAtPosition(getCurrentItem()); if (child == null) { child = getChildAt(0);/*from w w w . j av a2 s. c o m*/ } if (child == null) { return; } int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if ((view.getPaddingLeft() != itemMarginLeft || view.getPaddingTop() != itemMarginTop || view.getPaddingRight() != itemMarginRight || view.getPaddingBottom() != itemMarginBottom)) { view.setPadding(itemMarginLeft, itemMarginTop, itemMarginRight, itemMarginBottom); } } ViewGroup.LayoutParams lp = child.getLayoutParams(); final int childWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width); final int childHeightSpec = getChildMeasureSpec(heightMeasureSpec, 0, lp.height); int childWidth = (int) ((MeasureSpec.getSize(childWidthSpec) - getPaddingLeft() - getPaddingRight()) * pagerAdapter.getPageWidth(getCurrentItem())); int childHeight = 0; if (!Double.isNaN(itemRatio)) { int itemHeight = (int) (childWidth / itemRatio); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY)); } } else { for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if (pagerAdapter.getPageWidth(getCurrentItem()) != 1) { view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); } else { view.measure(childWidthSpec, childHeightSpec); } } } childWidth = itemMarginLeft + child.getMeasuredWidth() + itemMarginRight; childHeight = itemMarginTop + child.getMeasuredHeight() + itemMarginBottom; if (!Float.isNaN(ratio)) { heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (getMeasuredWidth() / ratio), MeasureSpec.EXACTLY); setMeasuredDimension(widthMeasureSpec, heightMeasureSpec); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), heightMeasureSpec); } } else { if (autoMeasureHeight) { constrainLength = MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY); setMeasuredDimension(getMeasuredWidth(), childHeight); } } if (!pagerAdapter.isEnableMultiScr()) { return; } int pageLength = getMeasuredWidth(); final int childLength = child.getMeasuredWidth(); // Check that the measurement was successful if (childLength > 0) { int difference = pageLength - childLength; if (getPageMargin() == 0) { setPageMargin(-difference); } int offscreen = (int) Math.ceil((float) pageLength / (float) childLength) + 1; setOffscreenPageLimit(offscreen); requestLayout(); } }
From source file:com.tmall.wireless.tangram3.view.BannerViewPager.java
protected void onMeasurePage(int widthMeasureSpec, int heightMeasureSpec) { if (pagerAdapter == null) { return;//w ww . j a va 2 s . c o m } View child = pagerAdapter.getViewAtPosition(getCurrentItem()); if (child == null) { child = getChildAt(0); } if (child == null) { return; } int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if ((view.getPaddingLeft() != itemMarginLeft || view.getPaddingTop() != itemMarginTop || view.getPaddingRight() != itemMarginRight || view.getPaddingBottom() != itemMarginBottom)) { view.setPadding(itemMarginLeft, itemMarginTop, itemMarginRight, itemMarginBottom); } } ViewGroup.LayoutParams lp = child.getLayoutParams(); final int childWidthSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width); final int childHeightSpec = getChildMeasureSpec(heightMeasureSpec, 0, lp.height); int childWidth = (int) ((MeasureSpec.getSize(childWidthSpec) - getPaddingLeft() - getPaddingRight()) * pagerAdapter.getPageWidth(getCurrentItem())); int childHeight = 0; if (!Double.isNaN(itemRatio) || itemRatio != 0) { int itemHeight = (int) (childWidth / itemRatio); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(itemHeight, MeasureSpec.EXACTLY)); } } else { for (int i = 0; i < childCount; i++) { View view = getChildAt(i); if (pagerAdapter.getPageWidth(getCurrentItem()) != 1) { view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); } else { view.measure(childWidthSpec, childHeightSpec); } } } childWidth = itemMarginLeft + child.getMeasuredWidth() + itemMarginRight; childHeight = itemMarginTop + child.getMeasuredHeight() + itemMarginBottom; if (!Float.isNaN(ratio)) { heightMeasureSpec = MeasureSpec.makeMeasureSpec((int) (getMeasuredWidth() / ratio), MeasureSpec.EXACTLY); setMeasuredDimension(widthMeasureSpec, heightMeasureSpec); for (int i = 0; i < childCount; i++) { View view = getChildAt(i); view.measure(MeasureSpec.makeMeasureSpec(childWidth, MeasureSpec.EXACTLY), heightMeasureSpec); } } else { if (autoMeasureHeight) { constrainLength = MeasureSpec.makeMeasureSpec(childHeight, MeasureSpec.EXACTLY); setMeasuredDimension(getMeasuredWidth(), childHeight); } } if (!pagerAdapter.isEnableMultiScr()) { return; } int pageLength = getMeasuredWidth(); final int childLength = child.getMeasuredWidth(); // Check that the measurement was successful if (childLength > 0) { int difference = pageLength - childLength; if (getPageMargin() == 0) { setPageMargin(-difference); } int offscreen = (int) Math.ceil((float) pageLength / (float) childLength) + 1; setOffscreenPageLimit(offscreen); requestLayout(); } }
From source file:com.android.contacts.list.MultiSelectContactsListFragment.java
private void setListViewPaddingTop(View listView, int paddingTop) { listView.setPadding(listView.getPaddingLeft(), paddingTop, listView.getPaddingRight(), listView.getPaddingBottom()); }
From source file:com.brq.wallet.lt.activity.buy.AdSearchFragment.java
private void setBackgroundResource(View theView, int backgroundResource) { int bottom = theView.getPaddingBottom(); int top = theView.getPaddingTop(); int right = theView.getPaddingRight(); int left = theView.getPaddingLeft(); theView.setBackgroundResource(backgroundResource); theView.setPadding(left, top, right, bottom); }