【问题标题】:How to fit image in full screen in ImageViewTouch如何在 ImageViewTouch 中全屏显示图像
【发布时间】:2013-05-02 14:57:23
【问题描述】:

我正在使用[ImageViewTouch][1] 库来缩放图像而不是图像视图。

<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" />

我想在 ImageViewTouch 控件上加载图像,图像的宽度将自动适合我的屏幕。 如何只让宽度和高度都适合我的手机屏幕?

在这里,当我执行 3 次双击时,意味着第 1 次它会放大第 2 次,但在第 3 次它完全适合设备屏幕的高度和宽度,为什么它在第一次时不适合。

但它在第一次加载时不适合高度和宽度。?请帮我解决这个问题。

我使用了这个库类可能是我必须在这里更改一些东西。

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

请检查截图:

第一次自动加载时:

双击 3 次后在这里表示第一次和第二次缩放,第三次非常适合为什么它在第一次 imageview 加载此图像时不适合。

我已经尝试了以下答案,但它不起作用。

感谢您的支持

【问题讨论】:

    标签: android android-layout android-imageview zooming universal-image-loader


    【解决方案1】:

    it.sephirot.android.library.imagezoom.ImageViewTouchBase换行

    protected DisplayType mScaleType = DisplayType.FIT_IF_BIGGER;
    

    protected DisplayType mScaleType = DisplayType.FIT_TO_SCREEN;
    

    【讨论】:

      【解决方案2】:

      我有同样的问题。在尝试了一些解决方法但没有成功后,终于解决了切换到这个库:https://github.com/MikeOrtiz/TouchImageView

      【讨论】:

        【解决方案3】:

        取自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" />
        

        【讨论】:

        • 感谢您的回答,但根据这篇文章,如果我使用示例应用程序中的相同图像,我将无法在我的设备中看到图像。看到这个帖子stackoverflow.com/questions/13359205/…
        【解决方案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" />
        

        我认为 fitXY 适合 xy 坐标

        【讨论】:

          【解决方案5】:

          尝试为您的 imageView 调用函数 setDisplayType(DisplayType.FIT_TO_SCREEN)

          【讨论】:

            【解决方案6】:

            xml 中的刻度类型将不起作用。 你应该使用图书馆。刻度类型在这个类中设置,改变刻度类型 这里去it.sephiroth.android.library.imagezoom.ImageViewTouch

            在这个类中你可以看到setScaleType(ScaleType.MATRIX); 把它改成setScaleType(ScaleType.FIT_XY);

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2021-12-15
              • 2019-05-07
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 2018-04-24
              相关资源
              最近更新 更多