I've attached some sample code with the issue. I create a listview with two lines and a bitmap. I disable the second label so I have just the image and one lable. I want to center the text vertically, can't seem to figure it out!!
Sub Globals
Dim listview1 As ListView
Dim bitmap1 As Bitmap
End Sub
Sub Activity_Create(FirstTime As Boolean)
bitmap1.Initialize(File.DirAssets, "fldricon.gif")
Listview1.Initialize("listview1")
ListView1.TwoLinesLayout.Label.TextSize=18
ListView1.TwoLinesLayout.ItemHeight=60
ListView1.TwoLinesAndBitmap.SecondLabel.Visible=False
ListView1.TwoLinesAndBitmap.SecondLabel.Enabled=False
ListView1.TwoLinesAndBitmap.SecondLabel.RemoveView
Listview1.TwoLinesAndBitmap.Label.Gravity=Gravity.CENTER_VERTICAL
activity.AddView(listview1,0,0,50%x,100%y)
Listview1.AddTwoLinesAndBitmap("some string","",bitmap1)
End Sub
I've disabled the second label as you can see but the first label will not center vertically. Any and all help will be most appreciated!! Thanks
Two tips:
Use dip units when specifying screen sizes:
ListView1.TwoLinesLayout.ItemHeight=60dip
Set the label color to nonblack color to see the layout of the label. You will then see that the label doesn't changes its size when you hide the second label.
The solution is:
ListView1.TwoLinesAndBitmap.Label.Height = ListView1.TwoLinesLayout.ItemHeight