android - Build bitmap from view for map marker returns only background of the root element -
i trying build custom bitmap inflating view, insert values , drawingcache.
i managed inflate , picture of mainview's background, view on top not shown. missing?
layoutinflater inflater = layoutinflater.from(ctx); view markerview = inflater.inflate(r.layout.marker_layout, null, false); markerview.setdrawingcacheenabled(true); imageview eventimage = (imageview) markerview.findviewbyid(r.id.eventimage); textview textattending = (textview) markerview.findviewbyid(r.id.textattending); textview textfriendsattending = (textview) markerview.findviewbyid(r.id.textfriendsattending); eventimage.setimagebitmap(noctisevent.getpicturesmall()); textattending.settext(noctisevent.getattending() + ""); textfriendsattending.settext("na"); markerview.layout(0, 0, 144, 144); markerview.invalidate(); markerview.requestlayout(); markerview.builddrawingcache(); markerbitmap = bitmap.createbitmap(markerview.getdrawingcache());
the xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="144dp" android:layout_height="144dp" android:background="@drawable/marker_mask"> <imageview android:id="@+id/eventimage" android:layout_width="match_parent" android:layout_height="68dp" android:layout_margin="5dp" android:background="#33ff0000"/> <textview android:id="@+id/textattending" android:layout_width="60dp" android:layout_height="48dp" android:layout_margintop="75dp" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:text="999" android:textalignment="center" android:gravity="center" android:background="@color/g2"/> <textview android:id="@+id/textfriendsattending" android:layout_width="60dp" android:layout_height="48dp" android:layout_margintop="75dp" android:layout_marginleft="67dp" android:layout_marginright="5dp" android:text="999" android:textalignment="center" android:gravity="center" android:background="#330000ff" /> </relativelayout>
Comments
Post a Comment