当前位置: 首页>>代码示例>>Java>>正文


Java ImageView.getContext方法代码示例

本文整理汇总了Java中android.widget.ImageView.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java ImageView.getContext方法的具体用法?Java ImageView.getContext怎么用?Java ImageView.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ImageView的用法示例。


在下文中一共展示了ImageView.getContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadCircleImage

import android.widget.ImageView; //导入方法依赖的package包/类
public static void loadCircleImage(String url, final ImageView imageview) {
	if(StringUtils.isEmpty(url) || imageview == null) {
		return;
	}
	Context context = imageview.getContext();
	downloadImage(context, 0, url, new ImageDownloaderListener() {
		@Override
		public void onResult(boolean success, int index, String imageUrl, String imagePath, Bitmap bitmap) {
			if(success) {
				imageview.setScaleType(ImageView.ScaleType.CENTER_CROP);
				Bitmap rounded = com.mob.bbssdk.gui.helper.ImageHelper.getRoundBitmap(bitmap);
				imageview.setImageBitmap(rounded);
			}
		}
	});
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:17,代码来源:ImageDownloader.java

示例2: forceDownload

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * Same as download but the image is always downloaded and the cache is not
 * used. Kept private at the moment as its interest is not clear.
 */
private void forceDownload(Integer position, ImageView imageView, int rotate) {
    if (position == null) {
        imageView.setImageDrawable(null);
        return;
    }

    if (cancelPotentialDownload(position, imageView)) {
        BitmapFetcherTask task = new BitmapFetcherTask(imageView.getContext(), imageView, rotate);
        DownloadedDrawable downloadedDrawable = new DownloadedDrawable(imageView.getContext(), task, origId);
        imageView.setImageDrawable(downloadedDrawable);
        imageView.setMinimumHeight(colWidth);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            task.executeOnExecutor(executor, position);
        } else {
            try {
                task.execute(position);
            } catch (RejectedExecutionException e) {
                // Oh :(
            }
        }

    }
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:29,代码来源:ImageFetcher.java

示例3: PhotoViewAttacher

import android.widget.ImageView; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
    mImageView = new WeakReference<ImageView>(imageView);

    imageView.setOnTouchListener(this);

    mViewTreeObserver = imageView.getViewTreeObserver();
    mViewTreeObserver.addOnGlobalLayoutListener(this);

    // Make sure we using MATRIX Scale Type
    setImageViewScaleTypeMatrix(imageView);

    if (!imageView.isInEditMode()) {
        // Create Gesture Detectors...
        mScaleDragDetector = VersionedGestureDetector.newInstance(imageView.getContext(), this);

        mGestureDetector = new GestureDetector(imageView.getContext(),
                new GestureDetector.SimpleOnGestureListener() {

                    // forward long click listener
                    @Override
                    public void onLongPress(MotionEvent e) {
                        if (null != mLongClickListener) {
                            mLongClickListener.onLongClick(mImageView.get());
                        }
                    }
                });

        mGestureDetector.setOnDoubleTapListener(this);

        // Finally, update the UI so that we're zoomable
        setZoomable(true);
    }
}
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:34,代码来源:PhotoViewAttacher.java

示例4: onFling

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public void onFling(float startX, float startY, float velocityX,
                    float velocityY) {
    if (DEBUG) {
        LogManager.getLogger().d(
                LOG_TAG,
                "onFling. sX: " + startX + " sY: " + startY + " Vx: "
                        + velocityX + " Vy: " + velocityY);
    }
    ImageView imageView = getImageView();
    mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
    mCurrentFlingRunnable.fling(getImageViewWidth(imageView),
            getImageViewHeight(imageView), (int) velocityX, (int) velocityY);
    imageView.post(mCurrentFlingRunnable);
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:16,代码来源:PhotoViewAttacher.java

示例5: PhotoViewAttacher

import android.widget.ImageView; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
	mImageView = new WeakReference<ImageView>(imageView);

	imageView.setOnTouchListener(this);

	mViewTreeObserver = imageView.getViewTreeObserver();
	mViewTreeObserver.addOnGlobalLayoutListener(this);

	// Make sure we using MATRIX Scale Type
	setImageViewScaleTypeMatrix(imageView);

	if (!imageView.isInEditMode()) {
		// Create Gesture Detectors...
		mScaleDragDetector = VersionedGestureDetector.newInstance(
				imageView.getContext(), this);

		mGestureDetector = new GestureDetector(imageView.getContext(),
				new GestureDetector.SimpleOnGestureListener() {

					// forward long click listener
					@Override
					public void onLongPress(MotionEvent e) {
						if (null != mLongClickListener) {
							mLongClickListener.onLongClick(mImageView.get());
						}
					}
				});

		mGestureDetector.setOnDoubleTapListener(this);

		// Finally, update the UI so that we're zoomable
		setZoomable(true);
	}
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:35,代码来源:PhotoViewAttacher.java

示例6: PhotoViewAttacher

import android.widget.ImageView; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
	mImageView = new WeakReference<ImageView>(imageView);

	imageView.setOnTouchListener(this);

	mViewTreeObserver = imageView.getViewTreeObserver();
	mViewTreeObserver.addOnGlobalLayoutListener(this);

	// Make sure we using MATRIX Scale Type
	setImageViewScaleTypeMatrix(imageView);

	if (!imageView.isInEditMode()) {
		// Create Gesture Detectors...
		mScaleDragDetector = VersionedGestureDetector.newInstance(imageView.getContext(), this);

		mGestureDetector = new GestureDetector(imageView.getContext(),
				new GestureDetector.SimpleOnGestureListener() {

					// forward long click listener
					@Override
					public void onLongPress(MotionEvent e) {
						if(null != mLongClickListener) {
							mLongClickListener.onLongClick(mImageView.get());
						}
					}});

		mGestureDetector.setOnDoubleTapListener(this);

		// Finally, update the UI so that we're zoomable
		setZoomable(true);
	}
}
 
开发者ID:starn,项目名称:encdroidMC,代码行数:33,代码来源:PhotoViewAttacher.java

示例7: convert

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
protected void convert(BaseViewHolder helper, VideoListInfo.Video item) {
    AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext())
            .getAppComponent();
    ImageView imgbg = helper.getView(R.id.iv_bg);
    Context context = imgbg.getContext();
    mAppComponent.imageLoader().loadImage(context,
            ImageConfigImpl
                    .builder()
                    .url(item.getData().getCover().getFeed())
                    .imageView(imgbg)
                    .build());
    helper.setText(R.id.tv_name,item.getData().getTitle())
            .setText(R.id.tv_desc,getDetailStr(item));
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:16,代码来源:SearchAdapter.java

示例8: onFling

import android.widget.ImageView; //导入方法依赖的package包/类
public void onFling(float startX, float startY, float velocityX, float velocityY) {
    if (DEBUG) {
        LogManager.getLogger().d(LOG_TAG, "onFling. sX: " + startX + " sY: " + startY + " Vx: " + velocityX + " Vy: " + velocityY);
    }
    ImageView imageView = getImageView();
    this.mCurrentFlingRunnable = new FlingRunnable(this, imageView.getContext());
    this.mCurrentFlingRunnable.fling(getImageViewWidth(imageView), getImageViewHeight(imageView), (int) velocityX, (int) velocityY);
    imageView.post(this.mCurrentFlingRunnable);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:PhotoViewAttacher.java

示例9: loadImage

import android.widget.ImageView; //导入方法依赖的package包/类
public void loadImage(ImageView imageView, String url) {
    Context context = imageView.getContext();
    ColorDrawable cd = new ColorDrawable(ContextCompat.getColor(context, R.color.colorPrimary));
    Glide.with(context)
            .load(url)
            .placeholder(cd)
            .crossFade()
            .centerCrop()
            .into(imageView);
}
 
开发者ID:hbmartin,项目名称:firebase-chat-android-architecture-components,代码行数:11,代码来源:GlideImageManager.java

示例10: PhotoViewAttacher

import android.widget.ImageView; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView) {
	mImageView = new WeakReference<ImageView>(imageView);

	imageView.setOnTouchListener(this);

	mViewTreeObserver = imageView.getViewTreeObserver();
	mViewTreeObserver.addOnGlobalLayoutListener(this);

	// Make sure we using MATRIX Scale Type
	setImageViewScaleTypeMatrix(imageView);

	if (!imageView.isInEditMode()) {
		// Create Gesture Detectors...
		mScaleDragDetector = VersionedGestureDetector.newInstance(imageView.getContext(), this);

		mGestureDetector = new GestureDetector(imageView.getContext(),
				new GestureDetector.SimpleOnGestureListener() {

					// forward long click listener
					@Override
					public void onLongPress(MotionEvent e) {
						if (null != mLongClickListener) {
							mLongClickListener.onLongClick(mImageView.get());
						}
					}
				});

		mGestureDetector.setOnDoubleTapListener(this);

		// Finally, update the UI so that we're zoomable
		setZoomable(true);
	}
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:34,代码来源:PhotoViewAttacher.java

示例11: onFling

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public final void onFling(float startX, float startY, float velocityX, float velocityY) {
	if (DEBUG) {
		Log.d(LOG_TAG, "onFling. sX: " + startX + " sY: " + startY + " Vx: " + velocityX + " Vy: " + velocityY);
	}

	ImageView imageView = getImageView();
	if (hasDrawable(imageView)) {
		mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
		mCurrentFlingRunnable.fling(imageView.getWidth(), imageView.getHeight(), (int) velocityX, (int) velocityY);
		imageView.post(mCurrentFlingRunnable);
	}
}
 
开发者ID:funnyzhaov,项目名称:Tribe,代码行数:14,代码来源:PhotoViewAttacher.java

示例12: onFling

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public final void onFling(float startX, float startY, float velocityX,
                          float velocityY) {
    if (DEBUG) {
        LogManager.getLogger().d(
                LOG_TAG,
                "onFling. sX: " + startX + " sY: " + startY + " Vx: "
                        + velocityX + " Vy: " + velocityY);
    }
    ImageView imageView = getImageView();
    mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
    mCurrentFlingRunnable.fling(getImageViewWidth(imageView),
            getImageViewHeight(imageView), (int) velocityX, (int) velocityY);
    imageView.post(mCurrentFlingRunnable);
}
 
开发者ID:benniaobuguai,项目名称:android-project-gallery,代码行数:16,代码来源:PhotoViewAttacher.java

示例13: onFling

import android.widget.ImageView; //导入方法依赖的package包/类
@Override
public final void onFling(float startX, float startY, float velocityX, float velocityY) {
    if (DEBUG) {
        Log.d(LOG_TAG, "onFling. sX: " + startX + " sY: " + startY + " Vx: " + velocityX + " Vy: " + velocityY);
    }
    ImageView imageView = getImageView();
    if (hasDrawable(imageView)) {
        mCurrentFlingRunnable = new FlingRunnable(imageView.getContext());
        mCurrentFlingRunnable.fling(imageView.getWidth(), imageView.getHeight(), (int) velocityX, (int) velocityY);
        imageView.post(mCurrentFlingRunnable);
    }
}
 
开发者ID:liuke2016,项目名称:filepicker,代码行数:13,代码来源:PhotoViewAttacher.java

示例14: setImageViewResource

import android.widget.ImageView; //导入方法依赖的package包/类
/**
 * 通过android:imageUrl可以在xml布局中直接为ImageView设置url地址,这样方便业务中使用第三方库加载网络图片
 *
 * @param imageView xml中ImageView实例
 * @param imgUrl    网络图片地址
 */
@BindingAdapter({"android:imageUrl"})
public static void setImageViewResource(ImageView imageView, String imgUrl) {
    Context context = imageView.getContext();
    //此处通过imgUrl字符串获取资源ID,具体使用根据业务需要
    int resId = context.getResources().getIdentifier(imgUrl, "drawable", context.getPackageName());
    imageView.setImageResource(resId);
}
 
开发者ID:free46000,项目名称:MultiItem,代码行数:14,代码来源:DataBindUtil.java

示例15: PhotoViewAttacher

import android.widget.ImageView; //导入方法依赖的package包/类
public PhotoViewAttacher(ImageView imageView, boolean zoomable) {
    mImageView = new WeakReference<>(imageView);

    imageView.setDrawingCacheEnabled(true);
    imageView.setOnTouchListener(this);

    ViewTreeObserver observer = imageView.getViewTreeObserver();
    if (null != observer)
        observer.addOnGlobalLayoutListener(this);

    // Make sure we using MATRIX Scale Type
    setImageViewScaleTypeMatrix(imageView);

    if (imageView.isInEditMode()) {
        return;
    }
    // Create Gesture Detectors...
    mScaleDragDetector = VersionedGestureDetector.newInstance(
            imageView.getContext(), this);

    mGestureDetector = new GestureDetector(imageView.getContext(),
            new GestureDetector.SimpleOnGestureListener() {

                // forward long click listener
                @Override
                public void onLongPress(MotionEvent e) {
                    if (null != mLongClickListener) {
                        mLongClickListener.onLongClick(getImageView());
                    }
                }

                @Override
                public boolean onFling(MotionEvent e1, MotionEvent e2,
                                       float velocityX, float velocityY) {
                    if (mSingleFlingListener != null) {
                        if (getScale() > DEFAULT_MIN_SCALE) {
                            return false;
                        }

                        if (MotionEventCompat.getPointerCount(e1) > SINGLE_TOUCH
                                || MotionEventCompat.getPointerCount(e2) > SINGLE_TOUCH) {
                            return false;
                        }

                        return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY);
                    }
                    return false;
                }
            });

    mGestureDetector.setOnDoubleTapListener(new DefaultOnDoubleTapListener(this));
    mBaseRotation = 0.0f;

    // Finally, update the UI so that we're zoomable
    setZoomable(zoomable);
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:57,代码来源:PhotoViewAttacher.java


注:本文中的android.widget.ImageView.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。