majid majid - 3 months ago 8
Android Question

adding some picture on the other picture

I need to add some picture (like a flower) to the other picture (main picture) . i want to achieve that after user captures a picture then he can add the picture to that. Is there a library can solve my problem?
just like this picture :

enter image description here

Answer

You can use 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>

Or use

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);

OR You can use this library 'https://github.com/codepath/android_guides/wiki/Basic-Painting-with-Views'

Comments