Help with NinePatchDrawable

peve9

Member
Licensed User
Longtime User
Hi everyone ! I'd like to know how to obtain a speech bubble using the Erel's sample working with NinePatch Images.
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   SetNinePatchDrawable(Label1, "bubble_bl")
   SetNinePatchDrawable(Label2, "bubble_bl")
   SetNinePatchDrawable(Label3, "bubble_bl")
   Label1.BringToFront
   Label1.Text="ciao"
   SetNinePatchDrawable(ImageView1, "bubble_bl")
   SetNinePatchDrawable(ImageView2, "bubble_bl")
   
End Sub

Sub SetNinePatchDrawable(Control As View, ImageName As String)
   Dim r As Reflector
   Dim package As String
   Dim id As Int
   package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
   id = r.GetStaticField(package & ".R$drawable", ImageName)
   r.Target = r.GetContext
   r.Target = r.RunMethod("getResources")
   Control.Background = r.RunMethod2("getDrawable", id, "java.lang.int")
End Sub

I get problems in adding a text to the label because I have the image in foreground. Anyone can help me?


Thanks
 
Top