android - convert a textview, including those contents off the screen, to bitmap -


i want save(export) contents of myview, extends textview, bitmap.

i followed code: [this][1].

it works fine when size of text small.

but when there lots of texts, , of content out of screen, got showed in screen.

then add "layout" in code:

private class myview extends textview{     public myview(context context) {         super(context);         // todo auto-generated constructor stub     }      public bitmap export(){         layout l = getlayout();         int width = l.getwidth() + getpaddingleft() + getpaddingright();         int height = l.getheight() + getpaddingtop() + getpaddingbottom();          bitmap viewbitmap = bitmap.createbitmap(width, height, bitmap.config.argb_8888);         canvas canvas = new canvas(viewbitmap);           setcursorvisible(false);         layout(0, 0, width, height);         draw(canvas);          setcursorvisible(true);         return viewbitmap;     } } 

now strange thing happened:

the first time invoke "export"(i use option key that), got contents on screen.

when invoke "export" again, got complete contents, including out of screen.

why?

how "export" view, including contents cannot showed on screen?

thank you!

[1]: http://www.techjini.com/blog/2010/02/10/quicktip-how-to-convert-a-view-to-an-image-android/ this

i found out simpler way: put textview in scrollview. mytextview.draw(canvas) draw of text.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -