本文整理了Java中android.widget.ImageView.getScaleType()
方法的一些代码示例,展示了ImageView.getScaleType()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ImageView.getScaleType()
方法的具体详情如下:
包路径:android.widget.ImageView
类名称:ImageView
方法名:getScaleType
暂无
代码示例来源:origin: nostra13/Android-Universal-Image-Loader
switch (imageView.getScaleType()) {
case FIT_CENTER:
case FIT_XY:
代码示例来源:origin: bumptech/glide
public void cycleScaleType(View v) {
ImageView.ScaleType curr = imageViewRes.getScaleType();
Log.w(TAG, "cycle: current=" + curr);
ImageView.ScaleType[] all = ImageView.ScaleType.values();
int nextOrdinal = (curr.ordinal() + 1) % all.length;
ImageView.ScaleType next = all[nextOrdinal];
Log.w(TAG, "cycle: next=" + next);
imageViewRes.setScaleType(next);
imageViewNet.setScaleType(next);
reload();
}
代码示例来源:origin: jiangqqlmj/FastDev4Android
private void checkImageViewScaleType() {
ImageView imageView = getImageView();
/**
* PhotoView's getScaleType() will just divert to this.getScaleType() so
* only call if we're not attached to a PhotoView.
*/
if (null != imageView && !(imageView instanceof PhotoView)) {
if (imageView.getScaleType() != ScaleType.MATRIX) {
throw new IllegalStateException(
"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
}
}
}
代码示例来源:origin: wangdan/AisenWeiBo
private void checkImageViewScaleType() {
ImageView imageView = getImageView();
/**
* PhotoView's getScaleType() will just divert to this.getScaleType() so only call if we're
* not attached to a PhotoView.
*/
if (null != imageView && !(imageView instanceof PhotoView)) {
if (imageView.getScaleType() != ScaleType.MATRIX) {
throw new IllegalStateException(
"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
}
}
}
代码示例来源:origin: wangdan/AisenWeiBo
private void checkImageViewScaleType() {
ImageView imageView = getImageView();
/**
* PhotoView's getScaleType() will just divert to this.getScaleType() so only call if we're
* not attached to a PhotoView.
*/
if (null != imageView && !(imageView instanceof PhotoView)) {
if (imageView.getScaleType() != ScaleType.MATRIX) {
throw new IllegalStateException(
"The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher");
}
}
}
代码示例来源:origin: eleme/UETool
public static String getImageViewScaleType(ImageView imageView) {
return imageView.getScaleType().name();
}
代码示例来源:origin: bumptech/glide
private void reload() {
Log.w(TAG, "reloading");
((TextView) findViewById(R.id.button))
.setText(getString(R.string.scaleType, imageViewRes.getScaleType()));
loadRes();
loadNet();
}
代码示例来源:origin: square/assertj-android
public ImageViewAssert hasScaleType(ImageView.ScaleType type) {
isNotNull();
ImageView.ScaleType actualType = actual.getScaleType();
assertThat(actualType) //
.overridingErrorMessage("Expected scale type <%s> but was <%s>.", type, actualType) //
.isEqualTo(type);
return this;
}
}
代码示例来源:origin: bm-x/PhotoView
public static Info getImageViewInfo(ImageView imgView) {
int[] p = new int[2];
getLocation(imgView, p);
Drawable drawable = imgView.getDrawable();
Matrix matrix = imgView.getImageMatrix();
int width = getDrawableWidth(drawable);
int height = getDrawableHeight(drawable);
RectF imgRect = new RectF(0, 0, width, height);
matrix.mapRect(imgRect);
RectF rect = new RectF(p[0] + imgRect.left, p[1] + imgRect.top, p[0] + imgRect.right, p[1] + imgRect.bottom);
RectF widgetRect = new RectF(0, 0, imgView.getWidth(), imgView.getHeight());
RectF baseRect = new RectF(widgetRect);
PointF screenCenter = new PointF(widgetRect.width() / 2, widgetRect.height() / 2);
return new Info(rect, imgRect, widgetRect, baseRect, screenCenter, 1, 0, imgView.getScaleType());
}
代码示例来源:origin: Hitomis/transferee
public static PhotoInfo getImageViewInfo(ImageView imgView) {
int[] p = new int[2];
getLocation(imgView, p);
Drawable drawable = imgView.getDrawable();
Matrix matrix = imgView.getImageMatrix();
int width = getDrawableWidth(drawable);
int height = getDrawableHeight(drawable);
RectF imgRect = new RectF(0, 0, width, height);
matrix.mapRect(imgRect);
RectF rect = new RectF(p[0] + imgRect.left, p[1] + imgRect.top, p[0] + imgRect.right, p[1] + imgRect.bottom);
RectF widgetRect = new RectF(0, 0, imgView.getWidth(), imgView.getHeight());
RectF baseRect = new RectF(widgetRect);
PointF screenCenter = new PointF(widgetRect.width() / 2, widgetRect.height() / 2);
return new PhotoInfo(rect, imgRect, widgetRect, baseRect, screenCenter, 1, 0, imgView.getScaleType());
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
values.put(PROPNAME_BOUNDS, bounds);
Matrix matrix;
ImageView.ScaleType scaleType = imageView.getScaleType();
if (scaleType == ImageView.ScaleType.FIT_XY) {
matrix = imageView.getImageMatrix();
代码示例来源:origin: nostra13/Android-Universal-Image-Loader
if (vh <= 0) vh = bh;
final ImageView.ScaleType scaleType = imageView.getScaleType();
if (scaleType == null) {
return bitmap;
代码示例来源:origin: alexvasilkov/GestureViews
ImageViewHelper.applyScaleType(imageView.getScaleType(),
drawableWidth, drawableHeight, viewport.width(), viewport.height(),
imageView.getImageMatrix(), tmpMatrix);
代码示例来源:origin: bumptech/glide
if (!requestOptions.isTransformationSet()
&& requestOptions.isTransformationAllowed()
&& view.getScaleType() != null) {
switch (view.getScaleType()) {
case CENTER_CROP:
requestOptions = requestOptions.clone().optionalCenterCrop();
代码示例来源:origin: willowtreeapps/Hyperion-Android
@NonNull
@Override
public List<ViewAttribute> collect(ImageView view, AttributeTranslator attributeTranslator) {
List<ViewAttribute> attributes = new ArrayList<>();
attributes.add(new ViewAttribute("Image", view.getDrawable()));
attributes.add(new ViewAttribute<>("ScaleType", view.getScaleType().toString()));
return attributes;
}
}
代码示例来源:origin: guolindev/giffun
if (!isTransformationSet && view.getScaleType() != null) {
switch (view.getScaleType()) {
case CENTER_CROP:
applyCenterCrop();
代码示例来源:origin: weexteam/weex-hackernews
@Test
public void testSetProperty() throws Exception {
ImageView imageView = mWXImage.initComponentHostView(Robolectric.setupActivity(TestActivity.class));
mWXImage.mHost = imageView;
mWXImage.setProperty(Constants.Name.RESIZE_MODE, "cover");
ImageView.ScaleType scaleType = mWXImage.getHostView().getScaleType();
assertEquals(scaleType, ImageView.ScaleType.CENTER_CROP);
}
代码示例来源:origin: weexteam/weex-hackernews
@Test
public void testSetResizeMode() throws Exception {
ImageView imageView = mWXImage.initComponentHostView(Robolectric.setupActivity(TestActivity.class));
mWXImage.mHost = imageView;
mWXImage.setResizeMode("cover");
ImageView.ScaleType scaleType = mWXImage.getHostView().getScaleType();
assertEquals(scaleType, ImageView.ScaleType.CENTER_CROP);
}
代码示例来源:origin: weexteam/weex-hackernews
@Test
public void testSetResize() throws Exception {
ImageView imageView = mWXImage.initComponentHostView(Robolectric.setupActivity(TestActivity.class));
mWXImage.mHost = imageView;
mWXImage.setResize("cover");
ImageView.ScaleType scaleType = mWXImage.getHostView().getScaleType();
assertEquals(scaleType, ImageView.ScaleType.CENTER_CROP);
}
代码示例来源:origin: luhaoaimama1/zone-sdk
@Override
public void imageShowProperty(ImageView iv,float left, float top, int imageShowX, int imageShowY) {
System.out.println("scaleType :"+iv.getScaleType()+"\t left:"+left+" \ttop:"+top+" \timageShowX:"+imageShowX+"\timageShowY:"+imageShowY);
}
});
内容来源于网络,如有侵权,请联系作者删除!