当前位置: 首页>>代码示例>>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;未经允许,请勿转载。