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


Java Rect.set方法代碼示例

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


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

示例1: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
        public void getItemOffsets(Rect outRect, View view,
                                   RecyclerView parent, RecyclerView.State state) {
//            outRect.left = space;
//            outRect.right = space;
//            outRect.bottom = space;
            outRect.set(0, 20, 20, 20);


            // Add top margin only for the first item to avoid double space between items
//            if (parent.getChildLayoutPosition(view) == 0) {
//                outRect.top = space;
//            } else {
//                outRect.top = 0;
//            }
        }
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:ChargeAmountDividerDecoration.java

示例2: addShadowAndDescription

import android.graphics.Rect; //導入方法依賴的package包/類
/**
    * Draw a shadow around the given bitmap.
    * Also draw a description view on top of it
    *
 * @param artwork in
 * @param descriptionView in
 * @param srcCrop in
 * @param shrinkFactor in
 * @param shadowPaddingRect out
 * @return
 */
public Bitmap addShadowAndDescription( Bitmap artwork, View descriptionView, Rect srcCrop, float shrinkFactor, Rect shadowPaddingRect) {

	Rect spr = new Rect(0,0,0,0);
	Bitmap destBitmap = addShadow(artwork, srcCrop, shrinkFactor, spr);

	// Draw the description over the cover
	if (descriptionView!=null) {
		addDescription(destBitmap, descriptionView, spr);
	}

	if (shadowPaddingRect!=null) {
		shadowPaddingRect.set(spr);
	}

	return destBitmap;
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:28,代碼來源:ArtworkFactory.java

示例3: updateIconBounds

import android.graphics.Rect; //導入方法依賴的package包/類
private void updateIconBounds() {
    if (null != mIconDrawable) {
        Rect bounds = new Rect(mCircleDrawable.getBounds());
        bounds.set(bounds.left + mIconInsetLeft, bounds.top + mIconInsetTop, bounds.right - mIconInsetRight, bounds.bottom - mIconInsetBottom);
        mIconDrawable.setBounds(bounds);
    }
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:8,代碼來源:HoverMenuAdapter.java

示例4: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    super.getItemOffsets(outRect, view, parent, state);
    int position = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition();
    if (position > -1) {
        if (position == 0) {
            outRect.set(0, dp2px(view.getContext(), 18), 0, 0);
        }
    }
}
 
開發者ID:codeestX,項目名稱:ECardFlow,代碼行數:11,代碼來源:ItemAdapter.java

示例5: visibleFileRect

import android.graphics.Rect; //導入方法依賴的package包/類
/**
 * Find the area of the source file that is currently visible on screen, taking into account the
 * current scale, translation, orientation and clipped region. This is a convenience method; see
 * {@link #viewToFileRect(Rect, Rect)}.
 * @param fRect rectangle instance to which the result will be written. Re-use for efficiency.
 */
public void visibleFileRect(Rect fRect) {
    if (vTranslate == null || !readySent) {
        return;
    }
    fRect.set(0, 0, getWidth(), getHeight());
    viewToFileRect(fRect, fRect);
}
 
開發者ID:alphater,項目名稱:garras,代碼行數:14,代碼來源:SubsamplingScaleImageView.java

示例6: getPadding

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
    public boolean getPadding(Rect padding) {
        int vOffset = (int) Math.ceil(calculateVerticalPadding(mRawMaxShadowSize, mCornerRadius,
                mAddPaddingForCorners));
//        int hOffset = (int) Math.ceil(calculateHorizontalPadding(mRawMaxShadowSize, mCornerRadius,
//                mAddPaddingForCorners));
//        padding.set(hOffset, vOffset, hOffset, vOffset);
        padding.set(0, vOffset, 0, 0);
        return true;
    }
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:11,代碼來源:CustomShadow.java

示例7: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
public void getItemOffsets(Rect outRect, int itemPosition, RecyclerView parent) {
    if (mOrientation == VERTICAL_LIST) {
        outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
    } else {
        outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
    }
}
 
開發者ID:ceji-longquan,項目名稱:ceji_android,代碼行數:9,代碼來源:DividerItemDecoration.java

示例8: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
  super.getItemOffsets(outRect, view, parent, state);
  if (getOrientation(parent) == VERTICAL_LIST) {
    outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
  } else {
    outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
  }
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:10,代碼來源:DividerDecoration.java

示例9: getIconRect

import android.graphics.Rect; //導入方法依賴的package包/類
protected Rect getIconRect(int viewWidth, int viewHeight, int drawableWidth, int drawableHeight) {
    DragLayer dragLayer = mLauncher.getDragLayer();

    // Find the rect to animate to (the view is center aligned)
    Rect to = new Rect();
    dragLayer.getViewRectRelativeToSelf(this, to);

    final int width = drawableWidth;
    final int height = drawableHeight;

    final int left;
    final int right;

    if (Utilities.isRtl(getResources())) {
        right = to.right - getPaddingRight();
        left = right - width;
    } else {
        left = to.left + getPaddingLeft();
        right = left + width;
    }

    final int top = to.top + (getMeasuredHeight() - height) / 2;
    final int bottom = top +  height;

    to.set(left, top, right, bottom);

    // Center the destination rect about the trash icon
    final int xOffset = (int) -(viewWidth - width) / 2;
    final int yOffset = (int) -(viewHeight - height) / 2;
    to.offset(xOffset, yOffset);

    return to;
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:34,代碼來源:ButtonDropTarget.java

示例10: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    if (mOrientation == VERTICAL_LIST) {
        outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
    } else {
        outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
    }
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:9,代碼來源:DividerItemDecoration.java

示例11: getContentRect

import android.graphics.Rect; //導入方法依賴的package包/類
private Rect getContentRect() {
    Rect rect = new Rect();
    if (!TextUtils.isEmpty(mContentText)) {
        mTextPaint.getTextBounds(mContentText, 0, mContentText.length(), rect);
    } else {
        rect.set(0, 0, mContentBitmap.getWidth(), mContentBitmap.getHeight());
    }
    return rect;
}
 
開發者ID:yanbober,項目名稱:DreamDrawable,代碼行數:10,代碼來源:IconDrawable.java

示例12: getClippingRect

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
public void getClippingRect(Rect outClippingRect) {
  outClippingRect.set(Assertions.assertNotNull(mClippingRect));
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:5,代碼來源:ReactHorizontalScrollView.java

示例13: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    super.getItemOffsets(outRect, view, parent, state);
    outRect.set(0, 0, 0, mDividerHeight);
}
 
開發者ID:JackChan1999,項目名稱:VideoPlayer,代碼行數:6,代碼來源:RecycleViewDivider.java

示例14: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
/**
 * 預留分割線的空間,
 * 主要是為了在每個Item的某一位置預留出分割線的空間 ,
 * 從而讓Decoration繪製在預留的空間內,
 * 注意這裏隻是預留了空間還沒有繪製內容的
 */
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
    /**
     *  outRect.set(left, top, right, bottom);
     *  在Item的四周設定距離
     *  所以當Orientation為垂直時,我們隻需要在每個Item的下方預留出分割線的高度就可以了
     *  同理當Orientation為水平時,我們隻需要在每個Item的右方預留出分割線的寬度就可以了
     *  但通常我們使用分割線的style都是統一的,這樣我們在attrs中隻需要定義一個即可,即共同使用Height
     */
    super.getItemOffsets(outRect, view, parent, state);
    /**item位置*/
    int position = parent.getChildAdapterPosition(view);
    /**item總數*/
    int count = parent.getAdapter().getItemCount();
    /**列表方向*/
    if (isVertical) {
        /**豎向列表*/
        if (position == 0) {
            if (isMarginTopShow) {
                /**第一個view,可以在頂部加一個margin值*/
                outRect.set(0, mDividerHeight, 0, mDividerHeight);
            } else {
                if (isMiddleShow) {
                    outRect.set(0, 0, 0, mDividerHeight);
                }
            }
        } else if (position >= count - 1) {
            if (isMarginBottomshow) {
                /**最後一個view,可以在底部加一個margin值*/
                outRect.set(0, 0, 0, mDividerHeight);
            }
        } else {
            if (isMiddleShow) {
                /**畫橫線,就是往下偏移一個分割線的高度*/
                outRect.set(0, 0, 0, mDividerHeight);
            }
        }
    } else {
        /**橫向列表*/
        if (position == 0) {
            if (isMarginTopShow) {
                /**第一個view,可以在頂部加一個margin值*/
                outRect.set(mDividerHeight, 0, mDividerHeight, 0);
            } else {
                if (isMiddleShow) {
                    outRect.set(0, 0, mDividerHeight, 0);
                }
            }
        } else if (position >= count - 1) {
            if (isMarginBottomshow) {
                /**最後一個view,可以在底部加一個margin值*/
                outRect.set(0, 0, mDividerHeight, 0);
            }
        } else {
            if (isMiddleShow) {
                /**畫豎線,就是往右偏移一個分割線的寬度*/
                outRect.set(0, 0, mDividerHeight, 0);
            }
        }
    }
}
 
開發者ID:weileng11,項目名稱:KUtils-master,代碼行數:68,代碼來源:DividerItemDecoration.java

示例15: getItemOffsets

import android.graphics.Rect; //導入方法依賴的package包/類
@Override public void getItemOffsets(Rect outRect, int position, int positionType) {
  if (positionType == POSITION_LAST_ITEM) {
    return;
  }
  outRect.set(0, 0, 0, mDivider.getIntrinsicHeight() * 4);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:ThickItemDecorator.java


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