本文整理汇总了Java中uk.co.senab.photoview.PhotoView.setImageResource方法的典型用法代码示例。如果您正苦于以下问题:Java PhotoView.setImageResource方法的具体用法?Java PhotoView.setImageResource怎么用?Java PhotoView.setImageResource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类uk.co.senab.photoview.PhotoView
的用法示例。
在下文中一共展示了PhotoView.setImageResource方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayImage
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
/**
* 加载普通图片
*/
private void displayImage(PhotoView photoView, byte[] res) {
photoView.setVisibility(View.VISIBLE);
Bitmap bitmap = byteArrayToBitmap(res);
if (bitmap == null) {
photoView.setImageResource(R.mipmap.default_img_rect);
} else {
photoView.setImageBitmap(bitmap);
}
photoView.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
@Override
public void onPhotoTap(View view, float x, float y) {
aty.finish();
}
});
}
示例2: instantiateItem
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
photoView.setImageResource(sDrawables[position]);
PhotoViewAttacher attacher = new PhotoViewAttacher(photoView);
attacher.setRotatable(true);
attacher.setToRightAngle(true);
attacher.setOnRotateListener(new PhotoViewAttacher.OnRotateListener() {
@Override
public void onRotate(int degree) {
//do something
}
});
attacher.update();
// Now just add PhotoView to ViewPager and return it
container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return photoView;
}
示例3: instantiateItem
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
View view = getLayoutInflater().inflate(R.layout.viewpager_very_image, container, false);
PhotoView zoom_image_view = (PhotoView) view.findViewById(R.id.zoom_image_view);
ProgressBar spinner = (ProgressBar) view.findViewById(R.id.loading);
spinner.setVisibility(View.GONE);
if (imageId != 0) {
zoom_image_view.setImageResource(imageId);
}
zoom_image_view.setOnPhotoTapListener(ViewBigImageActivity.this);
container.addView(view, 0);
return view;
}
示例4: showExcessPic
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
/** 展示过度图片 */
private void showExcessPic(ImageInfo imageInfo, PhotoView imageView) {
//先获取大图的缓存图片
Bitmap cacheImage = NineGridView.getImageLoader().getCacheImage(imageInfo.bigImageUrl);
//如果大图的缓存不存在,在获取小图的缓存
if (cacheImage == null) cacheImage = NineGridView.getImageLoader().getCacheImage(imageInfo.thumbnailUrl);
//如果没有任何缓存,使用默认图片,否者使用缓存
if (cacheImage == null) {
imageView.setImageResource(R.drawable.ic_default_image);
} else {
imageView.setImageBitmap(cacheImage);
}
}
示例5: instantiateItem
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, final int position) {
PhotoView photoView = new PhotoView(ShowPhotoListActivity.this);
photoView.setScaleType(ImageView.ScaleType.FIT_CENTER);
if (!MainActivity.mIsLoadPhoto) {
Glide.with(ShowPhotoListActivity.this).load(mPhotoList.get(position))
.error(R.drawable.photo_loaderror)
.placeholder(R.drawable.loading_photo)
.dontAnimate()
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(photoView);
} else {
if (MainActivity.mIsWIFIState) {
Glide.with(ShowPhotoListActivity.this).load(mPhotoList.get(position))
.error(R.drawable.photo_loaderror)
.placeholder(R.drawable.loading_photo)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.dontAnimate()
.into(photoView);
} else {
photoView.setImageResource(R.drawable.photo_default);
}
}
container.addView(photoView, mLps);
photoView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showPopupWindow(position);
return false;
}
});
return photoView;
}
示例6: onCreate
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fullscreen);
mPhotoView = (PhotoView) findViewById(R.id.photoview);
mPhotoView.setImageResource(R.drawable.saya);
}
示例7: instantiateItem
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
PhotoView photoview = new PhotoView(ViewPagerDemo.this);
photoview.setImageResource(R.drawable.saya);
container.addView(photoview, LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
return photoview;
}
示例8: onCreate
import uk.co.senab.photoview.PhotoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_show_photo);
PhotoView showPhoto = (PhotoView) findViewById(R.id.iv_show_photo);
mImgUrl = getIntent().getStringExtra("ImageUrl");
if (mImgUrl.contains(".gif")) {
Glide.with(this).load(mImgUrl)
.asGif()
.error(R.drawable.photo_loaderror)
.placeholder(R.drawable.loading_photo)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(showPhoto);
} else {
if (!MainActivity.mIsLoadPhoto) {
Glide.with(this).load(mImgUrl).asBitmap()
.error(R.drawable.photo_loaderror)
.placeholder(R.drawable.loading_photo)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.dontAnimate()
.into(showPhoto);
} else {
if (MainActivity.mIsWIFIState) {
Glide.with(this).load(mImgUrl).asBitmap()
.error(R.drawable.photo_loaderror)
.placeholder(R.drawable.loading_photo)
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.dontAnimate()
.into(showPhoto);
} else {
showPhoto.setImageResource(R.drawable.photo_default);
}
}
}
showPhoto.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showPopupWindow();
return false;
}
});
}