android - Bitmap of ListVIew Item -
how create bitmap of part of item in listview.
each item of listview have 4 components, 2 textview , 2 button. want create bitmap 2 textview when click on button.
your item layout have components: textview1, textview2, button1, button2. have put textview1 , textview2 in child layout, exclude button1 + button2 bitmap, instance:
<relativelayout> <!-- main item layout --> <relativelayout android:id="@+id/relativelayouttextviews"> <!-- child layout textviews --> <textview> <!-- text view 1 --> </textview> <textview> <!-- text view 2 --> </textview> </relativelayout> <button> <!-- button 1 --> </button> <button> <!-- button 2 --> </button> </relativelayout>
and in java code:
relativelayout layout = (relativelayout) findviewbyid(r.id.relativelayouttextviews); if (layout != null) { bitmap image = bitmap.createbitmap(layout.getwidth(), layout.getheight(), config.argb_8888); canvas b = new canvas(image); drawable bgdrawable =layout.getbackground(); if (bgdrawable!=null) bgdrawable.draw(canvas); else canvas.drawcolor(color.white); layout.draw(b);} }