help listview

alim2012

Member
Licensed User
Longtime User
hi all
I want use image with center one line text in listview.
but I can not let text in center near the picture in listview.
please help me
thanks a lot
:sign0010: :sign0010: :sign0010: :sign0010::BangHead: :BangHead: :BangHead:
 

klaus

Expert
Licensed User
Longtime User
There is no standard setting with one line and a bitmap.
But you can setup the TwoLinesAndBitmap layout.
The attached example shows it.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    ltvTest.Initialize("ltvTest")
    Activity.AddView(ltvTest, 0, 0,100%x , 100%y)
    
    bmpTest.Initialize(File.DirAssets, "rose.png")
    
    SetupListView
    
    FillListView
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub SetupListView
    ltvTest.TwoLinesAndBitmap.ItemHeight = 60dip
    ltvTest.TwoLinesAndBitmap.Label.Height = 60dip
    ltvTest.TwoLinesAndBitmap.Label.Left = ltvTest.TwoLinesAndBitmap.ImageView.Width
    ltvTest.TwoLinesAndBitmap.Label.Width = ltvTest.Width - ltvTest.TwoLinesAndBitmap.Label.Left
    ltvTest.TwoLinesAndBitmap.Label.Gravity = Gravity.CENTER
    ltvTest.TwoLinesAndBitmap.SecondLabel.Height = 0
End Sub

Sub FillListView
    Dim i As Int
    
    For i = 0 To 20
        ltvTest.AddTwoLinesAndBitmap("Test " &i, "", bmpTest)
    Next
End Sub
Best regards.
 

Attachments

  • ListViewOneLineBitmap.zip
    17.5 KB · Views: 254
Upvote 0
Top