Sub Globals
Private xui As XUI
Private ImageView1 As ImageView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
Dim bmp As B4XBitmap = DrawRoundedRect(ImageView1.Width, ImageView1.Height, 5dip, Array As Int(xui.Color_Blue, xui.Color_Yellow))
ImageView1.SetBackgroundImage(bmp)
End Sub
Sub DrawRoundedRect(Width As Int, Height As Int, Radius As Int, Clrs() As Int) As B4XBitmap
Dim Gradient As BitmapCreator
Gradient.Initialize(10, Height)
Gradient.FillGradient(Clrs, Gradient.TargetRect, "TOP_BOTTOM")
Dim Brush As BCBrush = Gradient.CreateBrushFromBitmapCreator(Gradient)
Dim bc As BitmapCreator
bc.Initialize(Width, Height)
bc.DrawRectRounded2(bc.TargetRect, Brush, True, 0, Radius)
Return bc.Bitmap
End Sub