Sub Activity_Create(FirstTime As Boolean)
pnBackground.Initialize("")
pnProgress.Initialize("")
Activity.AddView(pnBackground,20dip,20dip,200dip,24dip)
pnBackground.AddView(pnProgress,0,0,pnBackground.Width/2,pnBackground.Height)
Dim cd As ColorDrawable
cd.Initialize2(Colors.Transparent,24dip,2dip,Colors.Red)
pnBackground.Background = cd
pnProgress.Color = Colors.Red
pnBackground.AddView(CreateMask(pnBackground, 35dip, Colors.White), 0, 0, pnBackground.Width, pnBackground.Height)
End Sub
Sub CreateMask (pnl As Panel, radius As Float, BackgroundColor As Int) As ImageView
Dim bmp As Bitmap
bmp.InitializeMutable(pnl.Width, pnl.Height)
Dim cvs As Canvas
cvs.Initialize2(bmp)
cvs.DrawColor(BackgroundColor)
Dim p As Path
p.Initialize(0, 0)
Dim jo As JavaObject = p
Dim left = 0, top = 0, right = pnl.Width, bottom = pnl.Height As Float
jo.RunMethod("addRoundRect", Array(left, top, right, bottom, radius, radius, "CW"))
cvs.ClipPath(p)
cvs.DrawColor(Colors.Transparent)
Dim iv As ImageView
iv.Initialize("")
iv.Bitmap = bmp
Return iv
End Sub