multiple images in a one single image

和自甴很熟 提交于 2019-12-21 06:08:18

问题


I want to create a bitmap / image which has many images like "Collage" which has more then one images in a single picture.

I have stored all my images in a grid view but now i want to create a single image from all those images. And even i want to make few images click able

so what can be the road map to do this ? any sort of help / example will be helpful.

reference image


回答1:


    Bitmap pic1 = BitmapFactory.decodeResource(getResources(), R.drawable.pic1);    
    Bitmap pic2 = BitmapFactory.decodeResource(getResources(), R.drawable.pic2);      
    Bitmap bg= BitmapFactory.decodeResource(getResources(), R.drawable.background);
    Bitmap out1 = Bitmap.createBitmap(bg) ;        
    Canvas comboImage = new Canvas(out1);
    comboImage.drawBitmap(pic1, 10f, 20f, null); 
    comboImage.drawBitmap(pic2, 30f, 40f, null); 

out1 will have pic1 & pic2, with a background image bg.




回答2:


To create a single image from multiple images look at using Canvas. You can put bitmaps (and drawables) on a canvas. You can commit the changes and then push then to a single bitmap that you can then use. As far as making certain sections clickable after making it one single image, I will leave this up to someone else to explain, I am not worked directly with the ontouch() functions.



来源:https://stackoverflow.com/questions/3913940/multiple-images-in-a-one-single-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!