Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中创建图像的scollview位图?_Android_Android Bitmap - Fatal编程技术网

如何在android中创建图像的scollview位图?

如何在android中创建图像的scollview位图?,android,android-bitmap,Android,Android Bitmap,我已经为电影连环漫画做了一个演示,安卓。我正在将图像绑定到我的LinearLayout运行时,现在我想将整个可滚动视图保存到位图,我已经尝试了很多,但都给出了仅将当前可见屏幕保存到位图的解决方案,是否有人可以帮助我如何将整个可滚动视图(对屏幕不可见)保存到位图中,我的代码如下: xml <HorizontalScrollView android:id="@+id/horizontal_scroll_view" android:layout_width="wrap_conte

我已经为电影连环漫画做了一个演示,安卓。我正在将图像绑定到我的LinearLayout运行时,现在我想将整个可滚动视图保存到位图,我已经尝试了很多,但都给出了仅将当前可见屏幕保存到位图的解决方案,是否有人可以帮助我如何将整个可滚动视图(对屏幕不可见)保存到位图中,我的代码如下:

xml

<HorizontalScrollView
    android:id="@+id/horizontal_scroll_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="55dp"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="55dp"
    android:scrollbars="none" >

    <ScrollView
        android:id="@+id/scroler"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:scrollbars="none" >

        <LinearLayout
            android:id="@+id/mygallery"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical" />
    </ScrollView>
</HorizontalScrollView>

用这个我制作了垂直方向的胶片带。现在我想要这张胶片的位图来保存它。

你能详细说明你的问题吗?“所有视图的位图”到底是什么意思?
public static Bitmap loadBitmapFromView(View v) {
        Bitmap b = null;
            v.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            b = Bitmap.createBitmap(v.getMeasuredWidth(),
                    v.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
            Canvas c = new Canvas(b);
            v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
            v.draw(c);
        saveImageToInternalStorage(b);
        return b;
    }
public static Bitmap loadBitmapFromView(View v) {
        Bitmap b = null;
            v.measure(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            b = Bitmap.createBitmap(v.getMeasuredWidth(),
                    v.getMeasuredHeight(), Bitmap.Config.ARGB_8888);
            Canvas c = new Canvas(b);
            v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight());
            v.draw(c);
        saveImageToInternalStorage(b);
        return b;
    }