Hi everyone,
I am trying to save a scroll view as an image
and the problem is , that the image created is showing only the top view of the scroll,
and I need to create the image of the entire scroll.
I am using the code below for that.
does anyone know what should I do?
should I save every view in the scroll view as an image and then merge it to one image?
or there is a simple way?
Thanks
I am trying to save a scroll view as an image
and the problem is , that the image created is showing only the top view of the scroll,
and I need to create the image of the entire scroll.
I am using the code below for that.
does anyone know what should I do?
should I save every view in the scroll view as an image and then merge it to one image?
or there is a simple way?
Thanks
B4X:
Sub SavViewAsBitmap (aView As View) As Bitmap
Dim b As Bitmap
Dim c As Canvas
b.InitializeMutable(aView.Width, aView.Height *2) ' Initialize mutable bitmap to contain size of aView ...
c.Initialize2(b) ' Get bitmap canvas ...
' Get B4A.Canvas android.graphics.Canvas (Android native type) field
' We need it as native Android type in order to call the "draw" function below ...
Dim args(1) As Object
Dim types(1) As String
Dim r As Reflector
r.Target = c
args(0) = r.GetField("canvas") ' Get android.graphics.Canvas field ...
types(0) = "android.graphics.Canvas"
' Draw aView content onto the bitmap canvas ...
r.Target = aView
r.RunMethod4("draw", args, types)
Return b
End Sub