当前位置: 首页>>代码示例>>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;未经允许,请勿转载。