I broke my DrawText test - help!

CidTek

Active Member
Licensed User
Longtime User
I created a simple project that just demonstrates DrawText on a bitmap in a Listview. It was looking just the way I wanted it when I merely rearranged the declarations and broke the code into 2 small subs. This was done to facillate migrating my code into a real project that just needed the drawing on a bitmap code added.

Now my text is not being layered onto the bitmap or least not in a visible position.

Where is it going wrong?
 

Attachments

  • Test_Listview_DrawText.zip
    6.5 KB · Views: 254

MLDev

Active Member
Licensed User
Longtime User
I'm not sure why this worked. I just moved the bitmap assignment to ImageView1 before initializing Canvas1 and it works.

I changed this:

B4X:
For i=0 To 3
   BitMap1.Initialize(LoadBitmap(File.DirAssets, "button2.png"))
   Canvas1.Initialize(ImageView1)
   ImageView1.Bitmap=BitMap1.Bitmap
   Canvas1.DrawText(DrawTxt(i), x, y, Typeface.DEFAULT_BOLD, 18, Colors.white,"LEFT")
   ListView1.AddTwoLinesAndBitmap("First Row Text" & i, "SecondLabel Text" & i, ImageView1.Bitmap)
Next

To this:

B4X:
For i=0 To 3
   BitMap1.Initialize(LoadBitmap(File.DirAssets, "button2.png"))
   ImageView1.Bitmap=BitMap1.Bitmap
   Canvas1.Initialize(ImageView1)
   Canvas1.DrawText(DrawTxt(i), x, y, Typeface.DEFAULT_BOLD, 18, Colors.white,"LEFT")
   ListView1.AddTwoLinesAndBitmap("First Row Text" & i, "SecondLabel Text" & i, ImageView1.Bitmap)
Next
 
Upvote 0
Top