I have 2 images. I want to place one image onto other one by determining its coordinates which will be taken from a client. To be more specific, I will get coordinates for my first image from internet and i want to place this image on other one according to these coordinates. I already put these images into same Linear Layout but couldn't give coordinates and place first one onto second. I also used this code part for placing one image:
ImageView iv = FindViewById<ImageView>(Resource.Id.imageView1);
iv.SetImageResource(Resource.Drawable.Icon);
LinearLayout ll = FindViewById<LinearLayout>(Resource.Id.linearLayout1);
LinearLayout ly = new LinearLayout(this);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent, 0.0f);
p.SetMargins(20, 20, 60, 60);
ll.AddView(iv,p);
but program failed ll.AddView(iv,p); part. Please help me for this problem.
This should work for you if you are willing to use bitmaps
Bitmap mutableBitmap = originalImageBitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(mutableBitmap);
canvas.drawBitmap(overlayBitmap, null, new RectF(left, top, right, bottom), null);
Here you have your original image in a bitmap. You create a mutable bitmap that can be edited, then you create a canvas from the mutable bitmap, use RectF
to specify your overlay bitmap drawing parameters and you then simply paint the second bitmap onto the first and set the mutable bitmap back to your ImageView