如何裁剪图像,在transperant面积仅显示? [英] How to Crop image that displaying only in transperant area?

查看:229
本文介绍了如何裁剪图像,在transperant面积仅显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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>

这篇关于如何裁剪图像,在transperant面积仅显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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