Android的:如何绘制多幅图像相同的ImageView内,但在移动的y坐标? [英] Android : How to Draw multiple images inside the same imageview but shifted in the y coordinate?
本文介绍了Android的:如何绘制多幅图像相同的ImageView内,但在移动的y坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的Android应用程序,我有一个水平列表视图和垂直的纵向包含触碰图像的图像就一定要到水平的看法,但每3人必须在同一图像视图中绘制在彼此和上移,使所有的图像显示,谢谢
in my android application i have a horizontal list view and a vertical one the vertical contains images on touching any of the images it must go to the horizontal view but every 3 of them must be drawn over each other in the same image view and shifted upwards so that all the images appear , Thanks
推荐答案
使用code作秀2图像中的一个图像:
use this code for show 2 image in one image:
ImageView myImageView = (ImageView) findViewById(R.id.img1);
Bitmap bitmap1 = BitmapFactory.decodeResource(getResources(), R.drawable.call);
Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.available);
Bitmap combinedBitmap = getCombinedBitmap(pic2, pic1);
myImageView.setImageBitmap(b);
和这是 getCombinedBitmap()方式:
public Bitmap getCombinedBitmap(Bitmap b, Bitmap b2) {
Bitmap drawnBitmap = null;
try {
drawnBitmap = Bitmap.createBitmap(200, 200, Config.ARGB_8888);
Canvas canvas = new Canvas(drawnBitmap);
// JUST CHANGE TO DIFFERENT Bitmaps and coordinates .
canvas.drawBitmap(b, 0, 0, null);
canvas.drawBitmap(b2, 0, 0, null);
//for more images :
// canvas.drawBitmap(b3, 0, 0, null);
// canvas.drawBitmap(b4, 0, 0, null);
}
catch (Exception e) {
e.printStackTrace();
}
return drawnBitmap;
}
享受:)
这篇关于Android的:如何绘制多幅图像相同的ImageView内,但在移动的y坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文