相关疑难解决方法(0)

以全长的方式截取RecyclerView的屏幕截图

我想获得活动的"整页"截图.该视图包含一个包含许多项目的RecyclerView.

我可以使用此功能截取当前视图的屏幕截图:

public Bitmap getScreenBitmap() {
    View v= findViewById(R.id.container).getRootView();
    v.setDrawingCacheEnabled(true);
    v.buildDrawingCache(true);
    Bitmap b = Bitmap.createBitmap(v.getDrawingCache());
    v.setDrawingCacheEnabled(false); // clear drawing cache
    return b;
}
Run Code Online (Sandbox Code Playgroud)

但它只包含我可以正常查看的项目(如预期的那样).

当我拍摄截图时,有什么方法可以让RecyclerView神奇地显示全长(一次显示所有项目)吗?

如果没有,我该如何处理这个问题?

java android

8
推荐指数
3
解决办法
5601
查看次数

从 Recycler 创建 PDF 查看完整内容?

这里已经提出了问题:创建完整长度的 RecyclerView PDF 我也有同样的问题,因为我还没有找到解决方案,我想生成完整长度的 RecyclerView 内容的 PDF。但没有找到解决方案。

我已经尝试了所有可用的解决方案以及从 RecycleView 生成 PDF 的所有可能方法。

我已经尝试过的解决方案:

https://gist.github.com/PrashamTrivedi/809d2541776c8c141d9a

截取 RecyclerView 的完整屏幕截图

将列表视图项转换为单个位图图像

已经尝试了上面提到的所有解决方案,但其中任何一个都不适合我,并且出现错误,有时宽度和高度问题,或者有时得到空的白色位图作为输出不知道为什么。

问题 :

我有 RecyclerView 与 HTML 内容以及内容之间的图像。

将以下屏幕视为包含内容的 RecyclerView。

在此输入图像描述

RecyclerView 中的内容与上图相同,包含 100 多个项目。

RecyclerView 项目布局:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<com.facebook.drawee.view.SimpleDraweeView
    android:id="@+id/leftImage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_weight="1"
    android:adjustViewBounds="true"
    android:maxHeight="350dp"
    fresco:actualImageScaleType="fitCenter"
    fresco:placeholderImage="@color/white" />

<jp.wasabeef.richeditor.RichEditor
    android:id="@+id/editor"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="@dimen/margin10dp"
    android:layout_marginRight="@dimen/margin10dp"
    android:layout_weight="1"
    android:clickable="false"
    android:focusable="false"
    android:focusableInTouchMode="false" />

<com.facebook.drawee.view.SimpleDraweeView
    android:id="@+id/rightImage"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_weight="1"
    android:adjustViewBounds="true"
    android:maxHeight="350dp"
    fresco:actualImageScaleType="fitCenter"
    fresco:placeholderImage="@color/white" />
</LinearLayout> …
Run Code Online (Sandbox Code Playgroud)

printing pdf android android-recyclerview

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×2

android-recyclerview ×1

java ×1

pdf ×1

printing ×1