Its possible to set any image inside other image in the pixel coordenates what i want?
First image is a big image, and the second image is a sign of a user.
I think witch canvas this is posible but i am not sure.
Anyone have a example of this?
You can use FrameLayout
, make big image to be the background and the little one to be on the foreground. You can change its gravity using the android:layout_gravity
attribute. FrameLayout
documentation here . Hope this helps.
You could make the first image the content of a class that extends from ImageView. Then in this class, override onDraw(Canvas canvas), drawing the second the image as a Bitmap at the coordinates you specify.
Eg
public class DoubleImage extends ImageView
{
private Bitmap mSecondBitmap;
public DoubleImage(Context context, AttributeSet attrs)
{
super(context, attrs);
// load the second image into mSecondBitmap
mSecondBitmap = BitmapFactory.decodeResource(context, R.drawable.my_second_image);
}
@Override
protected void onDraw(Canvas canvas)
{
super.onDraw(canvas);
canvas.drawBitmap(mSecondImage, x, y, null);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.