本文整理匯總了Java中android.widget.ImageView.ScaleType方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.ScaleType方法的具體用法?Java ImageView.ScaleType怎麽用?Java ImageView.ScaleType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.ScaleType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSetResizeMode
import android.widget.ImageView; //導入方法依賴的package包/類
@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);
}
示例2: isSupportedScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
private static boolean isSupportedScaleType(ImageView.ScaleType scaleType) {
if(null == scaleType) {
return false;
} else {
switch(scaleType.ordinal()) {
case 1:
throw new IllegalArgumentException(scaleType.name() + " is not supported in PhotoView");
default:
return true;
}
}
}
示例3: getItemImageView
import android.widget.ImageView; //導入方法依賴的package包/類
public static ImageView getItemImageView(Context context, @DrawableRes int placeholderResId, ImageView.ScaleType scaleType) {
ImageView imageView = new ImageView(context);
imageView.setImageResource(placeholderResId);
imageView.setClickable(true);
imageView.setScaleType(scaleType);
return imageView;
}
示例4: testSetResize
import android.widget.ImageView; //導入方法依賴的package包/類
@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);
}
示例5: setScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
public void setScaleType(ImageView.ScaleType scaleType) {
mKeyButtonView.setScaleType(scaleType);
}
示例6: getScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
public ImageView.ScaleType getScaleType() {
return mScaleType;
}
示例7: getImageScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
public ImageView.ScaleType getImageScaleType() {
return imageScaleType;
}
示例8: setImageScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
public T setImageScaleType(ImageView.ScaleType imageScaleType) {
mScaleType = imageScaleType;
return (T) this;
}
示例9: setImageScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
public Builder setImageScaleType(ImageView.ScaleType imageScaleType) {
options.imageScaleType = imageScaleType;
return this;
}
示例10: getImageThumbnail
import android.widget.ImageView; //導入方法依賴的package包/類
public static Bitmap getImageThumbnail(String path, int mMaxWidth, int mMaxHeight){
Bitmap.Config mDecodeConfig = Bitmap.Config.RGB_565;
ImageView.ScaleType mScaleType = ImageView.ScaleType.CENTER_CROP;
File bitmapFile = new File(path);
Bitmap bitmap = null;
if (!bitmapFile.exists() || !bitmapFile.isFile()) {
return bitmap;
}
BitmapFactory.Options decodeOptions = new BitmapFactory.Options();
decodeOptions.inInputShareable = true;
decodeOptions.inPurgeable = true;
decodeOptions.inPreferredConfig = mDecodeConfig;
if (mMaxWidth == 0 && mMaxHeight == 0) {
bitmap = BitmapFactory.decodeFile(bitmapFile.getAbsolutePath(), decodeOptions);
} else {
// If we have to resize this image, first get the natural bounds.
decodeOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(bitmapFile.getAbsolutePath(), decodeOptions);
int actualWidth = decodeOptions.outWidth;
int actualHeight = decodeOptions.outHeight;
// Then compute the dimensions we would ideally like to decode to.
int desiredWidth = getResizedDimension(mMaxWidth, mMaxHeight,
actualWidth, actualHeight, mScaleType);
int desiredHeight = getResizedDimension(mMaxHeight, mMaxWidth,
actualHeight, actualWidth, mScaleType);
// Decode to the nearest power of two scaling factor.
decodeOptions.inJustDecodeBounds = false;
decodeOptions.inSampleSize = ImageUtils.findBestSampleSize(actualWidth, actualHeight, desiredWidth, desiredHeight);
Bitmap tempBitmap = BitmapFactory.decodeFile(bitmapFile.getAbsolutePath(), decodeOptions);
// If necessary, scale down to the maximal acceptable size.
if (tempBitmap != null
&& (tempBitmap.getWidth() > desiredWidth || tempBitmap.getHeight() > desiredHeight)) {
bitmap = Bitmap.createScaledBitmap(tempBitmap, desiredWidth,
desiredHeight, true);
tempBitmap.recycle();
} else {
bitmap = tempBitmap;
}
}
return bitmap;
}
示例11: BitmapCallback
import android.widget.ImageView; //導入方法依賴的package包/類
public BitmapCallback(int maxWidth, int maxHeight, Bitmap.Config decodeConfig, ImageView.ScaleType scaleType) {
convert = new BitmapConvert(maxWidth, maxHeight, decodeConfig, scaleType);
}
示例12: testSetProperty
import android.widget.ImageView; //導入方法依賴的package包/類
@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);
}
示例13: getScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
/**
* Return the current scale type in use by the ImageView.
*
* @return current ImageView.ScaleType
*/
ImageView.ScaleType getScaleType();
示例14: setScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
/**
* Controls how the image should be resized or moved to match the size of
* the ImageView. Any scaling or panning will happen within the confines of
* this {@link ImageView.ScaleType}.
*
* @param scaleType - The desired scaling mode.
*/
void setScaleType(ImageView.ScaleType scaleType);
示例15: getScaleType
import android.widget.ImageView; //導入方法依賴的package包/類
/**
* Return the current scale type in use by the ImageView.
*/
ImageView.ScaleType getScaleType();