裁剪和放大图像而无需移动覆盖视图,而不是将图像中的ImageView [英] Crop and Zoom Image without Moving Overlay View Instead Move Image in ImageView

查看:207
本文介绍了裁剪和放大图像而无需移动覆盖视图,而不是将图像中的ImageView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想裁剪图像不动,覆盖视图,而不是移动图像。  

Hi I want to crop Image without moving Overlay view instead move Image.

图片可以被周围移动。我想裁剪并保存突出显示的区域,如下图所示的黑色边框内。

The image can be moved all around. I would like to crop and save the highlighted area as shown below inside the black border.

我有的ImageView 安卓scaleType =矩阵

下面是我的布局code

Here's my layout code

<RelativeLayout
    android:id="@+imageEdit/rl_ScaleImage"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+imageEdit/Topbar"
    android:visibility="visible" >

    <ImageView
        android:id="@+imageEdit/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:scaleType="matrix" />

    <View
        android:id="@+imageEdit/viewTop"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        android:background="#99000000" />

    <View
        android:id="@+imageEdit/view_scaledImage"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+imageEdit/viewBottom"
        android:layout_below="@+imageEdit/viewTop"
        android:background="@drawable/rounded_corner_small" />

    <View
        android:id="@+imageEdit/viewBottom"
        android:layout_width="fill_parent"
        android:layout_height="150dp"
        android:layout_alignParentBottom="true"
        android:background="#99000000" />
</RelativeLayout>

的ImageView OnTouchListener 。图像可以放大或缩小,也可沿 ImageView1 。查看 view_scaledImage 是我要裁剪并保存区。如何做到这一点?

ImageView has OnTouchListener. Image can be zoomed in or zoomed out and is also movable in ImageView1. View view_scaledImage is the area which I want to crop and save. How do I do this?

推荐答案

我终于得到了解决相结合,克罗帕图书馆的PhotoView库。

Finally I got the solution by combining Cropper library and PhotoView libraries.

https://github.com/rameshkec85/AndroidCropMoveScaleImage

这篇关于裁剪和放大图像而无需移动覆盖视图,而不是将图像中的ImageView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆