當前位置: 首頁>>代碼示例>>Java>>正文


Java View.getBottom方法代碼示例

本文整理匯總了Java中android.view.View.getBottom方法的典型用法代碼示例。如果您正苦於以下問題:Java View.getBottom方法的具體用法?Java View.getBottom怎麽用?Java View.getBottom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.View的用法示例。


在下文中一共展示了View.getBottom方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canScroll

import android.view.View; //導入方法依賴的package包/類
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        ViewGroup group = (ViewGroup) v;
        int scrollX = v.getScrollX();
        int scrollY = v.getScrollY();
        for (int i = group.getChildCount() - 1; i >= 0; i--) {
            View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() && y + scrollY >= child.getTop() && y + scrollY < child.getBottom()) {
                if (canScroll(child, true, dx, (x + scrollX) - child.getLeft(), (y + scrollY) - child.getTop())) {
                    return true;
                }
            }
        }
    }
    return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:17,代碼來源:ViewPager.java

示例2: getMostVisiblePosition

import android.view.View; //導入方法依賴的package包/類
/**
 * Gets the position of the view that is most prominently displayed within the list view.
 */
public int getMostVisiblePosition() {
    final int firstPosition = getFirstVisiblePosition();
    final int height = getHeight();

    int maxDisplayedHeight = 0;
    int mostVisibleIndex = 0;
    int i=0;
    int bottom = 0;
    while (bottom < height) {
        View child = getChildAt(i);
        if (child == null) {
            break;
        }
        bottom = child.getBottom();
        int displayedHeight = Math.min(bottom, height) - Math.max(0, child.getTop());
        if (displayedHeight > maxDisplayedHeight) {
            mostVisibleIndex = i;
            maxDisplayedHeight = displayedHeight;
        }
        i++;
    }
    return firstPosition + mostVisibleIndex;
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:27,代碼來源:DayPickerView.java

示例3: drawVertical

import android.view.View; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();

    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        android.support.v7.widget.RecyclerView v = new android.support.v7.widget.RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:liuchongming74,項目名稱:Android-HTTPS-based-on-MVVM,代碼行數:17,代碼來源:DividerItemDecoration.java

示例4: performCircularReveal

import android.view.View; //導入方法依賴的package包/類
private void performCircularReveal(View show) {
    show.setBackgroundColor(0xffff0000);
    ViewCompat.setTranslationY(show, 0);
    ViewCompat.setTranslationX(show, 0);
    show.getLayoutParams().height = 500;
    show.getLayoutParams().width = 1920;
    show.requestLayout();
    int centerX = (show.getLeft() + show.getRight()) / 2;
    int centerY = (show.getTop() + show.getBottom()) / 2;
    float finalRadius = (float) Math.hypot((double) centerX, (double) centerY);
    Animator mCircularReveal = ViewAnimationUtils.createCircularReveal(
            show, centerX, centerY, 0, finalRadius);
    mCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());
    mCircularReveal.setDuration(500);
    mCircularReveal.start();
}
 
開發者ID:teisun,項目名稱:SunmiUI,代碼行數:17,代碼來源:ImageSharedTransitionActivity.java

示例5: canScroll

import android.view.View; //導入方法依賴的package包/類
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx Delta scrolled in pixels
 * @param x X coordinate of the active touch point
 * @param y Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
  if (v instanceof ViewGroup) {
    final ViewGroup group = (ViewGroup) v;
    final int scrollX = v.getScrollX();
    final int scrollY = v.getScrollY();
    final int count = group.getChildCount();
    // Count backwards - let topmost views consume scroll distance first.
    for (int i = count - 1; i >= 0; i--) {
      final View child = group.getChildAt(i);
      if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&
          y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&
          canScroll(child, true, dx, x + scrollX - child.getLeft(),
              y + scrollY - child.getTop())) {
        return true;
      }
    }
  }
  return checkV && ViewCompat.canScrollHorizontally(v, -dx);
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:31,代碼來源:SlidingUpPanelLayout.java

示例6: draw

import android.view.View; //導入方法依賴的package包/類
private void draw(Canvas c, RecyclerView parent) {
	int left = parent.getPaddingLeft();
	int right = parent.getWidth() - parent.getPaddingRight();

	int childCount = parent.getChildCount();
	for (int i = 0; i < childCount; i++) {
		View child = parent.getChildAt(i);

		RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();

		int top = child.getBottom() + params.bottomMargin +
				Math.round(ViewCompat.getTranslationY(child));
		int bottom = top + mDivider.getIntrinsicHeight() + 1;

		mDivider.setBounds(left, top, right, bottom);
		mDivider.draw(c);
	}
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:DividerItemDecoration.java

示例7: drawVertical

import android.view.View; //導入方法依賴的package包/類
public void drawVertical(Canvas c, RecyclerView parent) {
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);

        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getTop() - params.topMargin;
        final int bottom = child.getBottom() + params.bottomMargin;
        final int left = child.getRight() + params.rightMargin;
        final int right = left + mDivider.getIntrinsicWidth();

        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:BittleDragon,項目名稱:MyRepository,代碼行數:17,代碼來源:DividerGridItemDecoration.java

示例8: onDrawOver

import android.view.View; //導入方法依賴的package包/類
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();

    int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        View child = parent.getChildAt(i);

        RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();

        int top = child.getBottom() + params.bottomMargin;
        int bottom = top + mDivider.getIntrinsicHeight();

        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:gbl08ma,項目名稱:underlx,代碼行數:19,代碼來源:SimpleDividerItemDecoration.java

示例9: drawVertical

import android.view.View; //導入方法依賴的package包/類
private void drawVertical(@NonNull Canvas c, @NonNull RecyclerView parent) {
    final int left = parent.getPaddingLeft();
    final int right = parent.getWidth() - parent.getPaddingRight();

    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View child = parent.getChildAt(i);
        RecyclerView v = new RecyclerView(parent.getContext());
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
                .getLayoutParams();
        final int top = child.getBottom() + params.bottomMargin;
        final int bottom = top + mDivider.getIntrinsicHeight();
        mDivider.setBounds(left, top, right, bottom);
        mDivider.draw(c);
    }
}
 
開發者ID:ThirtyDegreesRay,項目名稱:OpenHub,代碼行數:17,代碼來源:DividerItemDecoration.java

示例10: onDrawOver

import android.view.View; //導入方法依賴的package包/類
@Override
public void onDrawOver(Canvas c, RecyclerView parent,
    RecyclerView.State state) {
    super.onDrawOver(c, parent, state);

    // calculate left/right x-coordinates for all dividers
    int left = parent.getPaddingLeft();
    int right = parent.getWidth() - parent.getPaddingRight();

    // for every item but the last, draw a line below it
    for (int i = 0; i < parent.getChildCount() - 1; ++i) {
        View item = parent.getChildAt(i);  // get ith list item

        // calculate top/bottom y-coordinates for current divider
        int top = item.getBottom() + ((RecyclerView.LayoutParams)
            item.getLayoutParams()).bottomMargin;
        int bottom = top + divider.getIntrinsicHeight();

        // draw the divider with the calculated bounds
        divider.setBounds(left, top, right, bottom);
        divider.draw(c);
    }
}
 
開發者ID:MTBehnke,項目名稱:NightSkyGuide,代碼行數:24,代碼來源:ItemDivider.java

示例11: canScroll

import android.view.View; //導入方法依賴的package包/類
/**
 * Tests scrollability within child views of v given a delta of dx.
 *
 * @param v      View to test for horizontal scrollability
 * @param checkV Whether the view v passed should itself be checked for scrollability (true),
 *               or just its children (false).
 * @param dx     Delta scrolled in pixels
 * @param x      X coordinate of the active touch point
 * @param y      Y coordinate of the active touch point
 * @return true if child views of v can be scrolled by delta of dx.
 */
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
    if (v instanceof ViewGroup) {
        final ViewGroup group = (ViewGroup) v;
        final int scrollX = v.getScrollX();
        final int scrollY = v.getScrollY();
        final int count = group.getChildCount();
        // Count backwards - let topmost views consume scroll distance first.
        for (int i = count - 1; i >= 0; i--) {
            // TODO: Add versioned support here for transformed views.
            // This will not work for transformed views in Honeycomb+
            final View child = group.getChildAt(i);
            if (x + scrollX >= child.getLeft() && x + scrollX < child.getRight() &&
                    y + scrollY >= child.getTop() && y + scrollY < child.getBottom() &&
                    canScroll(child, true, dx, x + scrollX - child.getLeft(),
                            y + scrollY - child.getTop())) {
                return true;
            }
        }
    }

    return checkV && ViewCompat.canScrollHorizontally(v, (-dx));
}
 
開發者ID:Jusenr,項目名稱:RX_Demo,代碼行數:34,代碼來源:ResideLayout.java

示例12: getAnimation

import android.view.View; //導入方法依賴的package包/類
/**
 * This method takes some view and the values by which its top and bottom bounds
 * should be changed by. Given these params, an animation which will animate
 * these bound changes is created and returned.
 */
private Animator getAnimation(final View view, float translateTop, float translateBottom) {

    int top = view.getTop();
    int bottom = view.getBottom();

    int endTop = (int)(top + translateTop);
    int endBottom = (int)(bottom + translateBottom);

    PropertyValuesHolder translationTop = PropertyValuesHolder.ofInt("top", top, endTop);
    PropertyValuesHolder translationBottom = PropertyValuesHolder.ofInt("bottom", bottom,
            endBottom);

    return ObjectAnimator.ofPropertyValuesHolder(view, translationTop, translationBottom);
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:20,代碼來源:ExpandingListView.java

示例13: preparePositionData

import android.view.View; //導入方法依賴的package包/類
/**
 * 獲取title的位置信息,為打造不同的指示器、各種效果提供可能
 */
private void preparePositionData() {
    mPositionDataList.clear();
    for (int i = 0, j = mNavigatorHelper.getTotalCount(); i < j; i++) {
        PositionData data = new PositionData();
        View v = mTitleContainer.getChildAt(i);
        if (v != null) {
            data.mLeft = v.getLeft();
            data.mTop = v.getTop();
            data.mRight = v.getRight();
            data.mBottom = v.getBottom();
            if (v instanceof IMeasurablePagerTitleView) {
                IMeasurablePagerTitleView view = (IMeasurablePagerTitleView) v;
                data.mContentLeft = view.getContentLeft();
                data.mContentTop = view.getContentTop();
                data.mContentRight = view.getContentRight();
                data.mContentBottom = view.getContentBottom();
            } else {
                data.mContentLeft = data.mLeft;
                data.mContentTop = data.mTop;
                data.mContentRight = data.mRight;
                data.mContentBottom = data.mBottom;
            }
        }
        mPositionDataList.add(data);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:30,代碼來源:CommonNavigator.java

示例14: findTopChildUnder

import android.view.View; //導入方法依賴的package包/類
public View findTopChildUnder(int x, int y) {
    for (int i = this.mParentView.getChildCount() - 1; i >= 0; i--) {
        View child = this.mParentView.getChildAt(this.mCallback.getOrderedChildIndex(i));
        if (x >= child.getLeft() && x < child.getRight() && y >= child.getTop() && y < child.getBottom()) {
            return child;
        }
    }
    return null;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:10,代碼來源:ViewDragHelper.java

示例15: getStickTop

import android.view.View; //導入方法依賴的package包/類
private int getStickTop() {
    View view = findViewByPosition(stickPosition - 1);
    if (view == null) {
        view = findViewByPosition(stickPosition + 1);
        if (view == null) {
            return 0;
        } else {
            return view.getTop() - stickViewHeight;
        }
    } else {
        return view.getBottom();
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:14,代碼來源:StickLayoutManager.java


注:本文中的android.view.View.getBottom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。