TouchImageView
TouchImageView copied to clipboard
The TouchImageView is not correctly wrapped vertically when wrap content is used.
Same issue as #256
I am trying to wrap the TouchImageView with a border but there is an unpredictable artificial space at the top and bottom of the image when I use wrap_content for height. Layout inspector is showing the empty space belongs to the TouchImageView. it seems like adjustViewBounds = true is not applied. The problem is illustrated below. The image with the correctly wrapped view is using the AppCompatImageView, the other one uses TouchImageView. I am aware that TouchImageView extends AppCompatImageView so I guess the issue is somewhere in the additional code handling image resizing in TouchImageView.
Changing the view type below to TouchImageView breaks it.
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Did you debugged it already ?
I could not figure out why this is happening that's why I decided to post here in case contributors already know why this is happening.
I at least don't know what's wrong here
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
is overriding the height and basically acting like match_parent
Hi @JRWilding, you can see in the second screenshot that's not the case.