MikeOrtiz / TouchImageView

Adds touch functionality to Android ImageView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional blank space is displayed above and below image if scale type is matrix or centerInside

AlfaBravoX opened this issue · comments

I have this implementation:

<ScrollView
        android:id="@+id/im_scroll_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:nestedScrollingEnabled="true">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="5sp">

<com.ortiz.touchview.TouchImageView
                android:id="@+id/iv_wc_latest"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:scaleType="fitXY"
                android:tag="wc_latest_iv"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/id1"
                app:layout_constraintBottom_toTopOf="@+id/id2" />

I am programatically swapping different images in single view by image touch BTW. These images have different resolutions but all of them have 1.3 ratio. When images are displayed, additional blank space appears above and below image when scaleType is centerInside or matrix. Also none of scaleType is stretching image into view but with exception of fitXY, but it does not maintain aspect ratio. I need image fits im_scroll_view width and it sets high such a way that it is maintaining aspect ratio. Is this possibile?

In general, all is possible, it's just a question of time.
From my fare away point I can't help you without a running example which demonstrate the open issue.
Even when there is such a sample, nobody can guarantee to help you to fulfill it with reasonable time afford.

It's up to you how many time you invest to show your issue someone else

Ok, so here we go with the example I made. Green area shows how large space TouchImageView #1 widget is occupying, red area shows space of widget #2. So what is desired, would be that widget is occupying only the space (not more, not less) of the image itself when centerInside is used (or any other more appropriate).

Tests.zip

This is how to ask perfect #331
I guess this is what you want.
I close this