Android Question Checkerboard Fade on Panel

mmieher

Active Member
Licensed User
Longtime User
I am relatively new to fancy visual effects. I am sure I am missing something simple.

I am trying to eventually come up with a simple checkerboard fade for an ImageView. Step 1 is to fill a panel with small labels that have a different background color than the parent panel.

This code appears to do nothing other than write to the log.

B4X:
Sub CheckerboardFade(ivBackground As Int)    '    want ti add ivPanel as parameter but need to get the basics down first
   
    Dim ivTop As Int = ivPanel.Top
    Dim ivLeft As Int = ivPanel.Left
    Dim ivWidth As Int = ivPanel.Width
    Dim ivHeight As Int = ivPanel.Height
   
    Dim lBox(1000) As Label        '    Why 1000?  If I use Dim lbox() as Label I get index out of range error below
   
    '    Randomize all this after it actually draws a box
   
    Dim i,x,y As Int
   
    i = 0
   
    For x = 0 To ivWidth Step 10
       
        For y  = 0 To ivHeight Step 10
           
            i = i + 1
       
            lBox(i).Initialize("")
            lBox(i).Color = ivBackground
            lBox(i).Width = 10dip
            lBox(i).Height = 10dip
            lBox(i).Text = "!"    '    This is for testing.  Background of label should be enough to draw box
           
            ivPanel.AddView(lBox(i),ivLeft+(x * 10),ivTop + (y * 10),lBox(i).Width,lBox(i).Height)
            lBox(i).BringToFront
           
            Log( i & " " & x & " " & y)
       
        Next
           
    Next
   
End Sub

Any ideas?
Marc
 
Top