How to fit image in full screen in ImageViewTouch

与世无争的帅哥 提交于 2019-12-10 22:38:04

问题


I am using [ImageViewTouch][1] library to zoom a image instead of imageview.

<it.sephiroth.android.library.imagezoom.ImageViewTouch
           android:id="@+id/imageweb"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"
            android:adjustViewBounds="true"
           android:background="@drawable/bg_loading"
           android:scaleType="fitCenter" />

I want to load the image on ImageViewTouch control and the width of image will auto fits my screen. How to fit only width and height both to my mobile screen?

Here when i do 3 times double tap means in 1st time its get zoomed in 2nd time also but in 3rd times its fits to height and width of the the device screen perfectly why its not fit at the time of first time.

But its not loaded fit to height and width at first time.? Please help me to sort out this issue.

I used this library classes May be i have to change here some thing.

1) [first][2]
2) [second][3] 

Please Check Screenshots :

When first time its loaded automatically :

After 3 times double tap means here first and second time zoom and 3rd time its fits perfectly why its not fitted at the time of first time when imageview loaded this image.

I already tried below answers but its not works.

Thank you for support


回答1:


In it.sephirot.android.library.imagezoom.ImageViewTouchBase change the line

protected DisplayType mScaleType = DisplayType.FIT_IF_BIGGER;

in

protected DisplayType mScaleType = DisplayType.FIT_TO_SCREEN;



回答2:


I had the same issue. After trying a few workarounds without success, finally solved it switching to this library: https://github.com/MikeOrtiz/TouchImageView




回答3:


Taken from the example app:

<it.sephiroth.android.library.imagezoom.ImageViewTouch
        android:id="@+id/image"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:scaleType="fitCenter" />



回答4:


<it.sephiroth.android.library.imagezoom.ImageViewTouch
    android:id="@+id/image"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:scaleType="fitXY" />

I think fitXY is fit with the xy coordinate




回答5:


Try to call function setDisplayType(DisplayType.FIT_TO_SCREEN) for your imageView




回答6:


Scale type in the xml will not work. You should use the library. Scale type is set in this class, change the scale type Here go to it.sephiroth.android.library.imagezoom.ImageViewTouch

in this class you can see setScaleType(ScaleType.MATRIX); change this to setScaleType(ScaleType.FIT_XY);



来源:https://stackoverflow.com/questions/16341313/how-to-fit-image-in-full-screen-in-imageviewtouch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!