'Place keyboard on screen
For i = 0 To 25
If i<10 Then
OffsetX = (100%x - (10-i) * (Width-3) - 10)
OffsetY = 100%y - Width * 4 + 20
Else If i<19 Then
OffsetX = (100%x - (20-i) * (Width-3) + 8)
OffsetY = 100%y - Width * 3 + 13
Else
OffsetX = (100%x - (28-i) * (Width-3) - 3)
OffsetY = 100%y - Width * 2 + 6
End If
Dim b As Button
b.Initialize("button")
Activity.AddView(b,OffsetX, OffsetY, Width, Width-5)
' Define a bitmap for Enabled state
Dim bdwEnabled As BitmapDrawable
bdwEnabled.Initialize(LoadBitmap(File.DirAssets, "btnunpressed20x15.png"))
' Define a bitmap for Pressed state
Dim bdwPressed As BitmapDrawable
bdwPressed.Initialize(LoadBitmap(File.DirAssets, "BtnPressed20x15.png"))
' Define a StateListDrawable
Dim stdBitmap As StateListDrawable
stdBitmap.Initialize
Dim states(2) As Int
states(0) = stdBitmap.state_enabled
states(1) = -stdBitmap.state_pressed
stdBitmap.addState2(states, bdwEnabled)
Dim states(1) As Int
states(0) = stdBitmap.state_enabled
stdBitmap.addState2(states, bdwPressed)
' Set stdBitmap to button btnBitmap
b.Background = stdBitmap
b.Typeface = Typeface.MONOSPACE
b.TextSize = 14 'was 12
b.Text = KeyLegends.SubString2(i,i+1)
b.Tag = Asc (b.Text)-65
b.TextColor = Colors.Black
Button(i) = b
Next