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