欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android PhotoView使用步驟實(shí)例詳解

 更新時(shí)間:2017年06月23日 15:04:32   投稿:lqh  
這篇文章主要介紹了Android PhotoView使用步驟實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下

Android PhotoView使用步驟實(shí)例詳解

1、步驟一:在布局文件中的代碼:

<uk.co.senab.photoview.PhotoView
    android:id="@+id/img_showimgview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    />

2、步驟二:進(jìn)行找到控件的id

photoview = (PhotoView) findViewById(R.id.img_showimgview);

3、步驟三:設(shè)置顯示

photoview.setImageBitmap(bit);

4、步驟四:進(jìn)行設(shè)置監(jiān)聽(tīng)

photoview.setOnPhotoTapListener(new OnPhotoTapListener() {

    @Override
    public void onPhotoTap(View view, float x, float y) {
      // TODO Auto-generated method stub
      finish();

    }
  });

在實(shí)現(xiàn)項(xiàng)目的需求的過(guò)程中,遇到了圖片失真的問(wèn)題,下面說(shuō)一下圖片失真的原因:

起初的實(shí)現(xiàn)方法是這樣的:

在點(diǎn)擊listview的條目的時(shí)候獲取到imageView中的圖片,在實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)的時(shí)候?qū)D像對(duì)象傳遞到下一個(gè)頁(yè)面

獲取ImageView中圖片的方法是:

img_get_photo.setDrawingCacheEnabled(true); 
bitt = Bitmap.createBitmap(img_get_photo.getDrawingCache()); 
img_get_photo.setDrawingCacheEnabled(false); 

問(wèn)題就出現(xiàn)在這里,此時(shí)獲得的bit,是imageview的“影像”并不是imageView中加載的圖片,通俗得說(shuō)就是對(duì)imageview進(jìn)行截屏處理,因?yàn)閘istview條目中是縮略圖,自然放大的時(shí)候就會(huì)失真。

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論