Answer the question
In order to leave comments, you need to log in
How to connect / superimpose images or “put on” “armor” on a drawn hero?
My task, if you pull it out of the general context of the idea:
A hero is created, all the necessary fields are written to the database.
Where information about the hero is displayed, his picture is also displayed. If the hero has armor or weapons in the database, for example, then they are displayed here as well.
The question is, how do I "put" a sword into the hero's hand or "put on" armor on him? Only this idea comes to mind: take the imageview of the hero, put the imageview of the sword on top and also on top of the imageview of the armor. But this is the last way I would like to solve this problem.
Does anyone have any ideas how to do it correctly?
Answer the question
In order to leave comments, you need to log in
Create 1 view.
Override onDraw and draw as many bitmaps as you need with the canvas.
PseudoCat.
@Override
public void onDraw(Canvas canvas) {
Bitmap image = BitmapFactory.decodeResource(getResources(),R.drawable.body);
canvas.drawBitmap(image, 0, 0, paint);
// if weapon exist
Bitmap image2 = BitmapFactory.decodeResource(getResources(),R.drawable.weapon);
canvas.drawBitmap(image2, 0, 0, paint);
// if armor exist
Bitmap image3 = BitmapFactory.decodeResource(getResources(),R.drawable.armor);
canvas.drawBitmap(image3, 0, 0, paint);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question