Android Question Canvans with image and label

anallie0

Active Member
Licensed User
Longtime User
Hi
is possible to insert in a canvans an image and a label?
thanks.
 

klaus

Expert
Licensed User
Longtime User
... is possible to insert in a canvas an image and a label?
What do you mean with this ?
You can draw an image and text onto a bitmap with the Canvas, but you cannot add a Label onto a Canvas.
You can add a Label above the target view of the Canvas but not 'into' the Canvas bitmap.

Best regards.
 
Upvote 0

anallie0

Active Member
Licensed User
Longtime User
I apologize
I want to use a ScrollView with an image in the first half of the screen and a label in the second half.
 
Upvote 0

anallie0

Active Member
Licensed User
Longtime User
so now I have written but not display anything

B4X:
Sub Globals
       
    Dim formula, guide, prodotti, web As Button
    Dim panelweb, panelprod, panelviewprod As Panel
    Dim listaweb, listaprod As ListView
    Dim testoprod As Label
    Dim scrollprod As ScrollView
    Dim immprod As ImageView

End Sub

Sub Activity_Create(FirstTime As Boolean)
    
    Activity.LoadLayout("formcollect")
   
       
    panelprod.SetLayout(0%x, 0%y, 100%x, 100%y)'pannello e lista dei prodotti
    listaprod.SetLayout(0%x, 0%y, 100%x, 100%y)
   
    panelviewprod.SetLayout(0%x, 0%y, 100%x, 100%y)'pannello visualizzazione dei prodotti
    scrollprod.Initialize(100)
    testoprod.Initialize("")
    immprod.Initialize("immprod")
   
    panelviewprod.AddView(scrollprod, 0%x, 0%y, 100%x, 100%y)
    scrollprod.Panel.AddView(immprod, 0%x, 0%y ,100%x, 50%y)
    scrollprod.Panel.AddView(testoprod, 0%x, 51%y ,100%x, 49%y)

End Sub

Sub listaprod_ItemClick (Position As Int, Value As Object)
Dim alphenoico As Bitmap
alphenoico.Initialize(File.DirAssets, "alphenoico.png")
immprod.Bitmap = LoadBitmap(File.DirAssets, "alphenoico.png")
testoprod.Text="jh cv doisjvfiosdjv  rd8 gsòui7syhghi8ahgisrhgihgishg87reygae9 i7er hgishglsehfoieshgg8xehfudhxx7hglgueu gi7r g7 ghsrei hgrdiuvhxd7fizwhgudh fidhghfgiuhei7ihgg  i7e "

panelviewprod.visible=True
   
End Sub
 
Upvote 0

anallie0

Active Member
Licensed User
Longtime User
hi Erel
I solved it, I don't calculation the length of the ScrollView.

B4X:
Dim pt As Float
Dim testo As String
   
testo="sycggcfvhcjhcvjfedhcvjfdhhreyfhweuyfvLe cause più frequenti di ostruzione nei neonati sono rappresentate da piccoli oggetti, cibo; ancia in su) sull’avambraccio al fine di garantirgli un appoggio il più possibile stabile." & CRLF & CRLF & "- Posizionare a sua volta l’avambraccio sulla coscia dello stesso lato, per favorire ulteriormente la stabilità." & CRLF & CRLF & "- Con la mano assicurare il capo del neonato fissando la nuca." & CRLF & CRLF & "- Posizionare la testa del neonato in posizione più declive rispetto al tronco." & CRLF & CRLF & "- Visualizzare una linea immaginaria tra i due capezzoli del neonato." & CRLF & CRLF & "Posizionare due dita (indice e medio) perpendicolari allo sterno subito sotto tale linea ed eseguire 5 compressioni lente e profonde in modo da determinare un aumento della pressione intratoracica (Tosse artificiale).huvfhiufhdsiuhvdsiudsijvcid vhvuidhvfiudjh cv doisjvfiosdjv  rd8 gsòui7syhghi8ahgisrhgihgishg87reygae9 i7er hgishglsehfoieshgg8xehfudhxx7hglgueu gi7r g7 ghsrei hgrdiuvhxd7fizwhgudh fidhghfgiuhei7ihgg  i7e ireigsi7 greiu heiuvhsifgzl8 ga87 sglezi gzrel 7ugzel7i gdr grsd7u gaeu aei7 hgaslihgaeli7hrei7gfh ri7ehgrei7hghfrhf iihaeiaeyhisrdh sr gyucjkdh"&CRLF& CRLF

    testoprod.Text= testo
    pt = StrUtil.MeasureMultilineTextHeight(testoprod, testo)    ' misura l'altezza della label
   



Dim rpkimm As Bitmap
rpkimm.Initialize(File.DirAssets, "rpkimm.png")
immprod.Bitmap = LoadBitmap(File.DirAssets, "rpkimm.png")

    scrollprod.Panel.Height = pt + immprod.Height             ' setta l'altezza dello scroll
    testoprod.Height = pt

panelviewprod.visible=True
 
Upvote 0
Top