本文整理汇总了Java中android.widget.ImageView.ScaleType.CENTER_INSIDE属性的典型用法代码示例。如果您正苦于以下问题:Java ScaleType.CENTER_INSIDE属性的具体用法?Java ScaleType.CENTER_INSIDE怎么用?Java ScaleType.CENTER_INSIDE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.widget.ImageView.ScaleType
的用法示例。
在下文中一共展示了ScaleType.CENTER_INSIDE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureBounds
private void configureBounds(Canvas canvas) {
Rect clipBounds = canvas.getClipBounds();
Matrix canvasMatrix = canvas.getMatrix();
if (ScaleType.CENTER == this.mScaleType) {
this.mBounds.set(clipBounds);
} else if (ScaleType.CENTER_CROP == this.mScaleType) {
applyScaleToRadii(canvasMatrix);
this.mBounds.set(clipBounds);
} else if (ScaleType.FIT_XY == this.mScaleType) {
Matrix m = new Matrix();
m.setRectToRect(this.mBitmapRect, new RectF(clipBounds), ScaleToFit.FILL);
this.mBitmapShader.setLocalMatrix(m);
this.mBounds.set(clipBounds);
} else if (ScaleType.FIT_START == this.mScaleType || ScaleType.FIT_END == this
.mScaleType || ScaleType.FIT_CENTER == this.mScaleType || ScaleType
.CENTER_INSIDE == this.mScaleType) {
applyScaleToRadii(canvasMatrix);
this.mBounds.set(this.mBitmapRect);
} else if (ScaleType.MATRIX == this.mScaleType) {
applyScaleToRadii(canvasMatrix);
this.mBounds.set(this.mBitmapRect);
}
}
示例2: adjustCanvasForBorder
private void adjustCanvasForBorder(Canvas canvas) {
float[] values = new float[9];
canvas.getMatrix().getValues(values);
float scaleFactorX = values[0];
float scaleFactorY = values[4];
float translateX = values[2];
float translateY = values[5];
float newScaleX = this.mBounds.width() / ((this.mBounds.width() + this.mBorderWidth)
+ this.mBorderWidth);
float newScaleY = this.mBounds.height() / ((this.mBounds.height() + this
.mBorderWidth) + this.mBorderWidth);
canvas.scale(newScaleX, newScaleY);
if (ScaleType.FIT_START == this.mScaleType || ScaleType.FIT_END == this.mScaleType ||
ScaleType.FIT_XY == this.mScaleType || ScaleType.FIT_CENTER == this
.mScaleType || ScaleType.CENTER_INSIDE == this.mScaleType || ScaleType.MATRIX
== this.mScaleType) {
canvas.translate(this.mBorderWidth, this.mBorderWidth);
} else if (ScaleType.CENTER == this.mScaleType || ScaleType.CENTER_CROP == this
.mScaleType) {
canvas.translate((-translateX) / (newScaleX * scaleFactorX), (-translateY) /
(newScaleY * scaleFactorY));
canvas.translate(-(this.mBounds.left - this.mBorderWidth), -(this.mBounds.top -
this.mBorderWidth));
}
}
示例3: ImageRequest
/**
* For API compatibility with the pre-ScaleType variant of the constructor. Equivalent to
* the normal constructor with {@code ScaleType.CENTER_INSIDE}.
*/
@Deprecated
public ImageRequest(String url, Response.Listener<Bitmap> listener, int maxWidth, int maxHeight,
Config decodeConfig, Response.ErrorListener errorListener) {
this(url, listener, maxWidth, maxHeight,
ScaleType.CENTER_INSIDE, decodeConfig, errorListener);
}
示例4: getIconScaleType
private static ScaleType getIconScaleType(int index, int keyId) {
if (mUseLargerIcons) {
return ScaleType.FIT_CENTER;
} else {
ScaleType origScaleType = mNavbarViewInfo[index] == null ? ScaleType.CENTER :
mNavbarViewInfo[index].originalScaleType.get(keyId, ScaleType.CENTER);
if (index == 0) {
return (mNavbarHeight < 75 ? ScaleType.CENTER_INSIDE : origScaleType);
} else {
boolean hasVerticalNavbar = mGbContext.getResources().getBoolean(R.bool.hasVerticalNavbar);
return (mNavbarWidth < 75 && hasVerticalNavbar ? ScaleType.CENTER_INSIDE :
origScaleType);
}
}
}
示例5: ImageRequest
@Deprecated
public ImageRequest(String url, Listener<Bitmap> listener, int maxWidth, int maxHeight, Config decodeConfig, ErrorListener errorListener) {
this(url, listener, maxWidth, maxHeight, ScaleType.CENTER_INSIDE, decodeConfig, errorListener);
}