Canvas.DrawText in ScrollView

danijel

Active Member
Licensed User
Longtime User
How to make canvas.drawtext scrolable?

for example I want to scroll down, but text is fixed on background and visible all the time.

Code: Copy
Sub Globals
   Dim SV As ScrollView
   Dim canvas1 As Canvas
End Sub

Sub Activity_Create(FirstTime As Boolean)
   SV.Initialize(1000dip)
   Activity.AddView(SV,0,0,100%x,100%y)
   canvas1.Initialize(Activity)
   canvas1.DrawTextRotated("Text",50dip,50dip,Typeface.MONOSPACE,30,Colors.Yellow,"CENTER",135)
End Sub

I probably need do something like this

Code: Copy
   canvas1.Initialize(SV)

but i dont know how :confused:
 
Hi danijel,

You almost had what you needed.

This example code should work for you. You will need to adjust your scrollview panel height and widths to suit for needs.

Code: Copy
Sub Activity_Create(FirstTime As Boolean)
  SV.Initialize(1000dip)
  SV.Panel.Height = 500dip
  SV.Panel.Width = 500dip
  Activity.AddView(SV,0,0,100%x,100%y)
  canvas1.Initialize(SV.Panel)
  canvas1.DrawTextRotated("Text",50dip,50dip,Typeface.MONOSPACE,30,Colors.Yellow,"CENTER",135)
End Sub
 
Upvote 0
Back
Top