如何裁剪图像,在transperant面积仅显示?图像、面积、transperant

2023-09-06 16:08:35 作者:得不到也忘不掉

在图像可以显示一帧是修复。我要裁剪的图像只显示在该框架的透明区域的一部分。所以如何找到一个帧的透明区域?以及如何获得只有落后的图像只显示为透明区域......?任何哥们知道,那么请让我现在...在此先感谢您花费时间和精力的问题。

in image you can show a frame which is fix. i want to crop part of image only showing in to transparent area of the frame. so how to find an transparent area of a frame ? and how to get only a behind image only showing into transparent area... ? any buddy know then please let me now ... thanks in advance to spent your time and effort into a question.

推荐答案

下面我们只是采取相对布局之间的两个图像视图。第一帧(以上单元的拍摄图像的视图)是固定和按钮点击监听器,我们的框架一个简单的逻辑是在这里调整背后的第二个图像。没有太多的复杂。

Here just we take two image view between relative layout. First frame(above image-view in snap shoot) is fix and on button click-listener a second image which we adjust behind the frame a simple logic is here. Not much complicated.

但主要的事情是,我们希望框架的透明区域。这里框架并不像上面的截图,但不管,像脸部或手什么的,我predeclared所以裁剪(帧透明部分),并把它放在另一个图像。

But main things is that we want to transparent area of frame. Here frame is not as like above screenshot but whatever, like face or hands whatever, I predeclared so crop it(a frame transparent part )and put it in another image.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<Button
    android:id="@+id/Button01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Browse gallery" >
</Button>
<ImageView
    android:id="@+id/ImageView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
     android:layout_below="@+id/Button01"
     >
</ImageView>

<ImageView
    android:id="@+id/ImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/Button01"
    android:background="@drawable/frame" >
</ImageView>