imageview - How to TOP CROP Image using PhotoView Android? -


i have 1 imageview layout_width & layout_height match_parent, 2 of them screen width , height size. need display photo fill full width , when image higher imageview height, can scroll , down. i'm using photoview library zoom, scroll, tap... i'm using centercrop scale type not solution need. show part of center image , need scroll view beginning.

i tried lot of custom view extended imageview display top crop style when touch image, changed default photoview scale type. work when not use photoviewattacher

how can make top crop , scroll + zoom + touch... image using photoview library ?

you can achieve topcrop scale changing center_crop scale under updatebasematrix() in photoviewattacher of chris banes`s photoview.

here code:

else if (mscaletype == scaletype.center_crop) {    float scale = math.max(widthscale, heightscale);     mbasematrix.postscale(scale, scale);     //changed dy = 0 top crop     mbasematrix.posttranslate((viewwidth - drawablewidth * scale) / 2f, 0); 

source: http://www.widecodes.com/fxsznwpevx/android-image-view-top-crop.html


since people requesting more scaletypes in imageview: https://code.google.com/p/android/issues/detail?id=58468 added custom scale types chris banes`s photoview.

i send pr him. since don't know if accept pr(or when), can project in github: https://github.com/jonathanrz/photoview/ , add aar project manually.

you can see example of usage in croptypeactivity in sample project inside library.


Comments

Popular posts from this blog

Change the color of an oval at click in Java AWT -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -

c# - MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(3243,9): error MSB4094 -