【发布时间】:2021-12-22 05:02:03
【问题描述】:
我在 imageview 中缩放图像时遇到了一些问题。下面是部分代码:
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/dimension_ratio_container"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintDimensionRatio="1:1">
<com.ortiz.touchview.TouchImageView
android:id="@+id/editor_second_image"
android:layout_width="0dp"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="center"
android:background="@color/gray_toolbar"
app:layout_constraintStart_toEndOf="@id/editor_divider"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<View
android:id="@+id/editor_divider"
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@color/black"
android:visibility="invisible"
app:layout_constraintEnd_toEndOf="parent"/>
<com.ortiz.touchview.TouchImageView
android:id="@+id/editor_first_image"
android:layout_width="0dp"
android:layout_height="match_parent"
android:scaleType="center"
android:adjustViewBounds="true"
android:background="@color/mainGreen"
app:layout_constraintEnd_toStartOf="@+id/editor_divider"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
我希望图像缩放同时保持其参数,并且我可以移动或缩放它。我使用 TouchImageView。问题是,如果我将带有专辑方向的图像放在第一个图像视图中,我将有这样的东西:
但是第二个 imageview 使用相同的参数设置了我想要的图像:
我该如何解决?
【问题讨论】:
标签: android xml kotlin imageview