High resolution screen shot in Android

前端 未结 4 1978
盖世英雄少女心
盖世英雄少女心 2021-01-31 10:58

Is there any way to get a high resolution screen shot of a certain view in an activity.

I want to convert html content of my webview to PDF. For that I

4条回答
  •  南笙
    南笙 (楼主)
    2021-01-31 11:39

    Sure, Use this:

    Bitmap bitmap;
    View v1 = MyView.getRootView();
    v1.setDrawingCacheEnabled(true);
    bitmap = Bitmap.createBitmap(v1.getDrawingCache());
    v1.setDrawingCacheEnabled(false);
    

    Here MyView is the View you need a screenshot of.

提交回复
热议问题