Android Question xCustomListView problem in vertical spacing

marcick

Well-Known Member
Licensed User
Longtime User
Hi all,
I'm adding custom layouts to a xCustomListView (B4A). They have 90 dips as height and I use this code:

B4X:
for x=1 to ...
    ClvLocList.Add(CreateListItem(x, ClvLocList.AsView.Width, 90dip),p.loc)
Next
...
...
Private Sub CreateListItem(Text As String, Width As Int, Height As Int) As B4XView
    Text=Text
    Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0, 0, 0, Width, Height)
    p.LoadLayout("loclistrow")
    Return p
End Sub

But I have different results in vertical spacing with different devices.
In the picture you see a Nexus 4", a PixelXL (6.3") and a Tab (9.9").
Pixel XL in the middle looks as I want, while I should use a height of 80 or 120 to have the same appearance on Nexus and Tab.
Brainstorming on DeviceScale, Root.height etc I'm not able to find the correct formula so that the vertical spacing is correct on any device.
Any help ?

1702372898021.png
 

marcick

Well-Known Member
Licensed User
Longtime User
Don't use AutoScale if the layout isn't a full screen / activity layout.

Looks like it is a thumb rule I should know very well .....
After years and years again I loose myself into very simple problems ... I'm no longer 30 ....
Thanks 👍
 
Upvote 0
Top