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


Java PhotoView.setImageResource方法代碼示例

本文整理匯總了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();
        }
    });
}
 
開發者ID:kymjs,項目名稱:KJGallery,代碼行數:21,代碼來源:SamplePagerAdapter.java

示例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;
}
 
開發者ID:ChenSiLiang,項目名稱:RotatePhotoView,代碼行數:20,代碼來源:ViewPagerPhotoViewFragment.java

示例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;
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:14,代碼來源:ViewBigImageActivity.java

示例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);
    }
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:14,代碼來源:ImagePreviewAdapter.java

示例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;
}
 
開發者ID:henryblue,項目名稱:TeaCup,代碼行數:35,代碼來源:ShowPhotoListActivity.java

示例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);
			
}
 
開發者ID:xulailing,項目名稱:android-open-project-demo-master,代碼行數:9,代碼來源:FullScreenDemo.java

示例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;
}
 
開發者ID:xulailing,項目名稱:android-open-project-demo-master,代碼行數:9,代碼來源:ViewPagerDemo.java

示例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;
        }
    });
}
 
開發者ID:henryblue,項目名稱:TeaCup,代碼行數:46,代碼來源:ShowPhotoActivity.java


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