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


Java ImageView.ScaleType方法代碼示例

本文整理匯總了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);

}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:12,代碼來源:WXImageTest.java

示例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;
        }
    }
}
 
開發者ID:leobert-lan,項目名稱:UiLib,代碼行數:13,代碼來源:PhotoViewAttacher.java

示例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;
}
 
開發者ID:weileng11,項目名稱:KUtils-master,代碼行數:8,代碼來源:BGABannerUtil.java

示例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);
}
 
開發者ID:weexext,項目名稱:ucar-weex-core,代碼行數:10,代碼來源:WXImageTest.java

示例5: setScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
public void setScaleType(ImageView.ScaleType scaleType) {
    mKeyButtonView.setScaleType(scaleType);
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:4,代碼來源:KeyButtonContainer.java

示例6: getScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
public ImageView.ScaleType getScaleType() {
    return mScaleType;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:ANRequest.java

示例7: getImageScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
public ImageView.ScaleType getImageScaleType() {
    return imageScaleType;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:ImageOptions.java

示例8: setImageScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
public T setImageScaleType(ImageView.ScaleType imageScaleType) {
    mScaleType = imageScaleType;
    return (T) this;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:ANRequest.java

示例9: setImageScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
public Builder setImageScaleType(ImageView.ScaleType imageScaleType) {
    options.imageScaleType = imageScaleType;
    return this;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:5,代碼來源:ImageOptions.java

示例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;
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:49,代碼來源:ImageUtils.java

示例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);
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:4,代碼來源:BitmapCallback.java

示例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);


}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:13,代碼來源:WXImageTest.java

示例13: getScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Return the current scale type in use by the ImageView.
 *
 * @return current ImageView.ScaleType
 */
ImageView.ScaleType getScaleType();
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:7,代碼來源:IPhotoView.java

示例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);
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:IPhotoView.java

示例15: getScaleType

import android.widget.ImageView; //導入方法依賴的package包/類
/**
 * Return the current scale type in use by the ImageView.
 */
ImageView.ScaleType getScaleType();
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:5,代碼來源:IPhotoView.java


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