Android Question DesignerLabel.SetBackgroundImage in CustomView XUI Views not work

AlfaizDev

Well-Known Member
Licensed User
B4X:
Dim bmp As Bitmap = (LoadBitmap(File.DirAssets, "button.jpg"))

    CLV1.DesignerLabel.SetBackgroundImage(bmp)

I want to set the background image for each item in the list
 

AlfaizDev

Well-Known Member
Licensed User
DesignerLabel is only used for the text properties of "AddText" items.

How are you creating the items?


B4X:
    cmd = SQL1.ExecQuery("SELECT  * FROM T where Title like '" & Main.CLV1Value &"'" )
    CLV1.Clear
    For i = 0 To cmd.RowCount -1
        cmd.Position = i
        'CLV1.GetBase.SetBitmap(bmp)
     
        Content= cmd.GetString("Content")
        FootNote=  cmd.GetString("FootNote")
        Id=cmd.GetInt("Id")

        CLV1.AddTextItem(Content ,Id)
'    
    Next
 
Last edited:
Upvote 0

AlfaizDev

Well-Known Member
Licensed User
B4X:
CLV1.AddTextItem(...)
Dim Panel As B4XView = CLV1.GetPanel(CLV1.Size - 1)
Panel.SetBitmap(...) 'if it is a cross platform project then you should add an ImageView or B4XImageView to the panel.

Thanks he works
Apply the code on the Label
B4X:
Dim Panel As B4XView = CLV1.GetPanel(i)
        Dim lbl As Label = Panel.GetView(0)
        lbl.SetBackgroundImage(bmp)
 
Last edited:
Upvote 0
Top