【发布时间】:2018-07-17 11:28:46
【问题描述】:
我需要缩放从相机拍摄并显示在 framelayout(而不是 imageview)中的图像,以便它保持并保持其纵横比。 到目前为止,我只能在 imageviews 中找到图像缩放,我无法为 framelayout 做到这一点。 注意:我在框架布局的 imageview 中显示太阳镜图片,来自 firebase 数据库。 所以基本上,framelayout 正在显示从相机拍摄的自拍照,然后我在其上放置随机的太阳镜框架,我可以在 framelayout 区域上拖动和旋转。 下面是 XML 的代码。
<FrameLayout
android:layout_width="match_parent"
android:id="@+id/frm"
android:layout_height="match_parent"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="6dp"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:layout_gravity="fill"
android:layout_marginBottom="8dp">
<ImageView android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_marginRight="6dp"
android:layout_marginLeft="6dp"
android:layout_gravity="center"
android:scaleType="matrix"
android:adjustViewBounds="true"/>
</FrameLayout>
【问题讨论】:
标签: android android-studio scaling aspect-ratio android-framelayout