Label text invisible for 9 Patch image

tamadon

Active Member
Licensed User
Longtime User
I've initialized a label via code to show the timer and use a nine patch image for its background. The 9 patch image is showing properly. However, the text is not update or rather invisible.

B4X:
   If lblTimerText.IsInitialized Then lblTimerText.RemoveView
   lblTimerText.Initialize("lblTimerText")
   Activity.AddView(lblTimerText, 0, pnlBarBottom.top - 30dip, 50dip, 30dip)
   lblTimerText.Gravity = Gravity.CENTER
   lblTimerText.Color = Colors.Transparent
   lblTimerText.TextColor = Colors.Black
   lblTimerText.TextSize = 14 
   lblTimerText.Typeface = Main.fontStyle
   lblTimerText.Visible = True
   lblTimerText.BringToFront
   SetNinePatchDrawable(lblTimerText, "timer")

In the update timer sub I have

B4X:
lblTimerText.Text = matchcode.ConvertTicksToMinutes(TimerService.TimeLimit)

How can show updating label text when used in conjunction with a nine patch image for its background?
 

tamadon

Active Member
Licensed User
Longtime User
Hi Erel,

Here's the sample project.

Margret, I tried changing the font color following your suggestion but it didn't work also.
 

Attachments

  • label9.zip
    9.8 KB · Views: 149
Upvote 0

klaus

Expert
Licensed User
Longtime User
There are two problems:
- the Label size is too small in width and height
- the nine patch image stretching area is too small

In the attached sample you can see the difference.
I added a modified nine patch image with a bigger stretching area.

Without the project it would have been almost impossible to help you !

Best regards.
 

Attachments

  • label9New.zip
    11.4 KB · Views: 174
Upvote 0

tamadon

Active Member
Licensed User
Longtime User
Hi klaus,

You are right, the label size is too small to fit the text :signOops:.

I set a small stretching area to ensure that the gradient is showing properly. But I noticed your version is actually 'sharper' which is good since it's a small label anyway.

Thanks for your help! :)
 
Upvote 0
Top