开发者

multiple images in a one single image

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

multiple images in a one single image


    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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜