Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim scvTest As ScrollView
Dim pnlTest As Panel
Dim SmileyImgView(1, 1) As ImageView
Dim Smiley As Bitmap
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
scvTest.Panel.LoadLayout("ScrollViewLayout")
scvTest.Panel.Height = pnlTest.Height
Add_Smiley
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub edtItem_FocusChanged (HasFocus As Boolean)
Dim Send As EditText
If HasFocus Then
Send = Sender
scvTest.ScrollPosition = Send.Top - 10dip
End If
End Sub
'**************************************************************************************
Sub Add_Smiley
Dim width, offsetX, offsetY As Int
width = GetDeviceLayoutValues.width /2
Smiley = LoadBitmap(File.DirAssets,"smiley.gif")
offsetX = 0'(100%x - width * 3 - 10dip * 2) / 2
offsetY = 0'(100%y - width * 3 - 10dip * 2) / 2
For x = 0 To 0
For y = 0 To 0
Dim s As ImageView
s.Initialize("ImageView") 'All SuggarImgView share the same event sub
's.Color = Colors.Transparent
s.SetBackgroundImage(Smiley)
Activity.AddView(s,offsetX + x * (width), offsetY + y * (width), width, width)
SmileyImgView(x, y) = s 'store a reference to this view
Next
Next
End Sub
'****************************************************************************************