Change the size of ImageView on zooming

后端 未结 8 2299
逝去的感伤
逝去的感伤 2021-02-14 01:15

I am using chrisbanes PhotoView to implement pinch zoom..Image zooms on pinching and double tapping but i can\'t see that my image streched to full screen on zooming..on zooming

8条回答
  •  失恋的感觉
    2021-02-14 01:48

    I will highly recommend having a look at Photo View:

    https://github.com/chrisbanes/PhotoView

    It was developed by Chris Banes who is one of the actual developers that worked on the Android development team, so you can't go wrong here. This library will save you A LOT of headaches.

    Usage is as simple as:

    ImageView mImageView;
    PhotoViewAttacher mAttacher;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
    
      // Any implementation of ImageView can be used!
      mImageView = (ImageView) findViewById(R.id.iv_photo);
    
      // Set the Drawable displayed
      Drawable bitmap = getResources().getDrawable(R.drawable.wallpaper);
      mImageView.setImageDrawable(bitmap);
    
      // Attach a PhotoViewAttacher, which takes care of all of the zooming functionality.
      mAttacher = new PhotoViewAttacher(mImageView);
    }
    

提交回复
热议问题