Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This might help... <a href="https://stackoverflow.com/questions/6075363/android-image-view-matrix-scale-translate">Android image view matrix scale + translate</a></p> <p>There seems to be two operations needed:</p> <ol> <li>Scale the container from 0.5 to 1.0</li> <li>Zoom the inner image from 2.0 to 1.0</li> </ol> <p>I assume this is as simple as</p> <pre><code>float zoom = 1.0F + value; float scale = 1.0F / zoom; img.setScaleX(scale); img.setScaleY(scale); ... matrix.postScale(zoom, zoom); </code></pre> <p>To scale/zoom from the center of the image you might need to do something like this (perhaps swapping the "-" order)...</p> <pre><code>matrix.postTranslate(translateCropX, translateCropY); matrix.postScale(zoom, zoom); matrix.postTranslate(-translateCropX, -translateCropY); </code></pre> <p>I'm not certain if this will animate (<a href="https://stackoverflow.com/questions/17395601/why-does-calling-setscalex-during-pinch-zoom-gesture-cause-flicker">Why does calling setScaleX during pinch zoom gesture cause flicker?</a>). Maybe this will help... <a href="http://developer.android.com/training/animation/zoom.html" rel="nofollow noreferrer">http://developer.android.com/training/animation/zoom.html</a></p> <p>The result is the inner image remains the same resolution, always.</p> <p>However you also mention portrait/landscape differences, so this gets a bit more complicated. I find the most difficult thing in cases such as this is to solidly define what you want to have happen in all cases.</p> <p>I'm guessing you're after a grid of small thumbnails, all of the same size (which mean they all have the same aspect ratio). You want to display images within the thumbnail containers of different aspect ratios and size, but zoomed in. When you select an image, the borders expand (overlapping other images?). There's the constraint that the shown image must keep the same resolution. You also mention that the complete image must be visible after selecting it, and twice the thumbnail size. This last point raises another question - twice the thumbnails height, width or both (in which case do you crop or scale if the image aspect ratio doesn't match). Another issue that might crop up is the case when an image has insufficient resolution.</p> <p>Hopefully android can do a lot of this for you... <a href="https://stackoverflow.com/questions/2521959/how-to-scale-an-image-in-imageview-to-keep-the-aspect-ratio">How to scale an Image in ImageView to keep the aspect ratio</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload