java - 在另一张图片上添加一些图片

标签 java android image-processing

我需要将一些图片(如花)添加到另一张图片(主图片)中。我想在用户捕获图片后实现这一点,然后他可以将图片添加到其中。有图书馆可以解决我的问题吗? 就像这张图片一样:

enter image description here

最佳答案

您可以使用 FrameLayout 。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

      >

    <ImageView
        android:id="@+id/image1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

      <ImageView
        android:id="@+id/image1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</RelativeLayout>

或者使用

Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);    
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(Color.BLACK);
canvas.drawBitmap(yourBitmap, 0, 0, paint) ; //Draw bitmap 
canvas.drawCircle(50, 50, 10, paint);        //Draw Circle
imageView.setImageBitmap(bitmap);

或 您可以使用此库'https://github.com/codepath/android_guides/wiki/Basic-Painting-with-Views '

关于java - 在另一张图片上添加一些图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35535709/

相关文章:

android - Kotlin 中硬关键字和软关键字的区别

matlab - 如何结合 SURF 和 Harris 点 MATLAB

php - 从 PHP/JS 中的图像识别 EAN/UPC 条码编号?

java - 如何使用 Arrays.equals 确定 2 个 2d 数组是否相同(意味着它们具有相同的数字但顺序不同)?在JAVA中

php - 如何在android中播放来自mysql数据库的视频

java - 字符变化列的自定义转换器 - from 方法中的参数为 null

android - CheckBox 被夹在平板电脑中

android - 使用opencv在Android中裁剪图像

java - 如何从现有的基于 XML 的 RESTful 服务创建 Java Jersey 客户端

java - Android 定时器 - Java 空指针异常