Android : Android: convert scrolling layout to Bitmap

on Thursday, July 10, 2014


I would like to convert the whole scrolling layout inside a ScrollView to a Bitmap



<ScrollView...>

<RelativeLayout android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
...>

</RelativeLayout>

</ScrollView>


If the content doesn't scroll, this code works:



RelativeLayout content = (RelativeLayout) findViewById(R.id.content);
content.setDrawingCacheEnabled(true);
content.buildDrawingCache();
Bitmap bm = content.getDrawingCache();


but if the content is scrolling, getDrawingCache() returns null.


Any suggestion on how I can export a scrolling view to a bitmap?


0 comments:

Post a Comment